If I have an OpenGL texture, and I need to perform HSL modifications on it before rendering the texture, from what I've heard I need a shader. Problem is, I know nothing about shaders. Does anyone know where I would need to look?
I want to write a function where I can pass in a texture and three values, a hue shift in degrees, and sat...
Hi Everybody,
I attended a technical interview a few days ago, and I was asked
How does the C compiler implments function with Variable number of arguments?
How does it pass the on the stack?
Does anyone know or can explian that?
Thanks,
Dan
...
I am trying to call a direct X funciton but I get the following error
error LNK2001: unresolved external symbol _D3DX10CreateTextureFromFileW@24
I understand that possibly there maybe a linker issue. But I am not sure where. I inluded both d3dx10.h and the d3d10.h. I also included the d3d10.lib file. Plus, the intellisense picks up on...
I'm attempting to create an sscanf string literal to aid in buffer overrun prevention in C99. The goal is something like:
#define MAX_ARG_LEN 16
char arg[MAX_ARG_LEN] = "";
if (sscanf(arg, "%"(MAX_ARG_LEN-1)"X", &input) > 0)
The obvious "manual" solution is something like:
#define MAX_ARG_LEN 16
#define MAX_ARG_CHARS "15"
char...
I am trying to wrap some legacy code for use in Java and I was quite happy to see that Swig was able to handle the header file and it generate a great wrapper that almost works. Now I am looking for the deep magic that will make it really work.
In C I have a function that looks like this
DLL_IMPORT int DustyVoodoo(char *buff, int len...
I'm trying to take a CGImage and copy its data into a buffer for later processing. The code below is what I have so far, but there's one thing I don't like about it - it's copying the image data twice. Once for CGDataProviderCopyData() and once for the :getBytes:length call on imgData. I haven't been able to find a way to copy the ima...
A friend sent me that code and alleges that it could damage the processor. Is that true?
void damage_processor() {
while (true) {
// Assembly code that sets the five control registers bits to ones which causes a bunch of exceptions in the system and then damages the processor
Asm(
"mov cr0, 0xffffffff \n\...
Hi,
How do I use Go's "foreign function interface" to call out to a C function?
This interface is mentioned on the FAQ, but I cannot see it mentioned elsewhere in the docs.
...
Hey, I'm trying to convert a function I wrote to generate an array of longs that respresents Pascal's triangles into a function that returns an array of mpz_t's. However with the following code:
mpz_t* make_triangle(int rows, int* count) {
//compute triangle size using 1 + 2 + 3 + ... n = n(n + 1) / 2
*count = (rows * (rows + 1)) / 2;
m...
I have written a command line interface program in the C language. This kind of programs (as you know) waits for user commands typed in the terminal and reacts on depend of them. In fact, the program implements a callback function which parses the command and invokes the appropriate function in order to respond to the user.
Now, I have...
What's the simplest C image library for loading and saving? I just want a 2D array to test some algorithms, and built-in functions are not needed.
...
Possible Duplicate:
user warnings on msvc AND gcc?
I am trying to come up with a relatively clean way of using the preprocessor to generate a custom warning message in C code that works for multiple compilers (MS VC, gcc, AIX, sun, etc).
I am mostly interested in warning about deprecated items, but also just for general use....
MASSIVE EDIT:
I have a long int variable that I need to convert to a signed 24bit hexadecimal string without the "0x" at the start. The string must be 6 characters followed by a string terminator '\0', so leading zeros need to be added.
Examples:
[-1 -> FFFFFF] ---
[1 -> 000001] ---
[71 -> 000047]
Answer
This seems to do the trick:
...
public static void main(String[] args) {
try {
String line;
InputStream stdout = null;
OutputStream stdin = null;
Process process = Runtime.getRuntime().exec("test.exe");
stdout = process.getInputStream ();
stdin = process.getOutputStream ();
...
So I have a program which creates a child process and executes a command (for example, ls). The parent will then use pipes to send to and get from the child. This works fine when I'm inputting commands myself from the command line.
However, when the input comes from a file, it seems like the child doesn't have enough time to run and I g...
I'm compiling a C program for a MIPS embedded system.
GCC keeps sticking in stuff like __do_global_dtors_aux, frame_dummy, __do_global_ctors_aux.
How can I avoid that?
Resolved: I just "fixed" it by passing -nostdlib to gcc. Silly me for forgetting that
...
Hi,
I am making a simulator and have written lots of files and headers. The problem is whenever I include a file I give the relative path of the particular file. For example a typical code in my application would begin like
#ifndef AI_H
#define AI_H
#include <cstdlib>
#include "../world/world.h"
#include "pathPlan.h"
#include "skil...
Hello,
I have a program that listens on port 443 and then redirects to either an SSH or HTTPS local server depending on the detected protocol.
The program does this by connecting to the local server and proxying all data back and forth through its own process.
However, this causes the originating host on the local servers to be logged...
I have an application that is receiving data from multiple multicast sources on the same port. I am able to receive the data. However, I am trying to account for statistics of each group (i.e. msgs received, bytes received) and all the data is getting mixed up. Does anyone know how to solved this problem? If I try to look at the sender's...
Is there any way to print a pointer to a function in ANSI C? Of course this means you have to cast the function pointer to void pointer, but it appears that's not possible??
#include <stdio.h>
int main() {
int (*funcptr)() = main;
printf("%p\n", (void* )funcptr);
printf("%p\n", (void* )main);
return 0;
}
$ gcc -a...