c

Determine highest .NET Framework version

I need to determine the highest .NET framework version installed on a desktop machine from C\C++ code. Looks like I can iterate the folders under %systemroot%\Microsoft.NET\Framework, but that seems kind of error prone. Is there a better way? Perhaps a registry key I can inspect? Thanks. ...

Build C project automaticly

I'm working on a free software (bsd license) project with others. We're searching for a system that check out our source code (svn) and build it also as test it (unit tests with Check / other tools). It should have a webbased interface and generate reports. I hope we don't have to write such a system from null by ourselves... ...

C wrapper to remove users on command "ps"

I have one question maybe someone here can help me. If i do "ps aux --sort user" on linux console I have one list of users and their processes runing on the machine. My question is how do I remove the users name and print that list like this in a C program: for example: (…) --------------------------------------------------------------...

C / C++ compiler warnings: do you clean up all your code to remove them or leave them in?

I've worked on many projects where I've been given code by others to update. More often than not I compile it and get about 1,000+ compiler warnings. When I see compiler warnings they make me feel dirty, so my first task is to clean up the code and remove them all. Typically I find about a dozen problems like uninitialized variables such...

How do I set a data breakpoint in Visual Studio 2005 on the address of a dereferenced pointer?

I wonder if there's a way to do the following: I have a structure containing a member which is a pointer to a block of memory allocated by the kernel when I pass the structure to an API function (the structure is a WAVEHDR, the member is the reserved field.) I can set a data breakpoint on the value of the reserved member - that in itsel...

How can I capture single keystrokes in a unix console app without blocking?

I have a very simple TCP server written in C. It runs indefinitely, waiting for connections. On Windows, I use select to check for activity on the socket, and if there isn't any, I have the following code to allow me to quit by hitting 'q' on the keyboard: if( kbhit() ) { char c = getch(); if( c == 'q' ) break; } This doesn't wo...

How do I learn C?

I'm interested in learning C better. I have read K & R, and I have even done some simple C extension work in R and Python. What's a worthwhile project idea for doing something more substantial with C? Any good online resources, similar to Dive Into Python? In particular, resources focused on programmers of newer languages who are try...

Monitoring memory usage for a C DLL called with Java via JNI?

How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is using ~70MB, but the task in the Task Manager shows 200Mb+, and I'd like to see what's in that 130MB...

gvim and gdb for C?

In emacs there is a handy way to launch the gdb and gui options for gdb, the C debugger. Is there a similar option in gvim? ...

How do I create a sparse file programmatically, in C, on Mac OS X?

I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible? ...

[C lib] Adding a TLS/SSL layer to communications..?

Hello everybody, My stuff is made with several components among which some are written in C. As I would like to add some security features, I am thinking of communicating over an SSL/TLS layer. Could you advise me some good lib to do this (if possible) ? ...

How to copy file from linux to windows server using c

I have to create a C program which will run on Linux server. It will take information from Oracle database, create a local file and then copy that file to Windows server. I know how to create a local file on Linux server. But what is the way to copy it to windows server from C? ...

Use absolute value of linker command file variable in 'C' code

I have a linker command file that assigns the top address of the stack into a variable _stack = . + 0x80000; I want to use this address in a 'c' program - I want to copy the stack to another location and then update the stack pointer to point to the new location before doing a destructive memory test on the orginal bank of RAM. I'm ...

How do I start reading the PHP source code?

The source code for the PHP interpreter is absolutely mystifying to me. The thing is, I'd like to learn more about it, so I can avoid making Schlemiel-style mistakes. This is a huge project, some nearly sixty megs in size. How do I go about reading it? Is there an article or a book out there somewhere to help me begin to make some se...

How do I enforce function signatures on a set of function declarations in C?

I want to make sure that a set of functions have the same signature in some C code. Ideally I would be able to define a new type that described the return value and arguments of a function and then declare my set of functions using this new type. Additionally, is there a way to specify default values for the arguments to this function ...

Function pointer cast to different signature.

I use a structure of function pointers to implement an interface for different backends. The signatures are very different, but the return values are almost all void, void * or int. struct my_interface { void (*func_a)(int i); void *(*func_b)(const char *bla); ... int (*func_z)(char foo); }; But it is not required ...

Linear algebra for graphics in C

I'm developing software that writes to a tiny LCD screen (less than 1" x 1"). I've got all the usual suspects - lines, filled polygons, fonts, etc. I remember, however, learning how to do fun vector manipulation in linear algebra many moons ago, and creating rotating wireframe objects. I'd like to do that again, but figured there must...

Detect GCC compile-time flags of a binary

Is there a way to find out what gcc flags a particular binary was compiled with? ...

What is a trampoline function?

During recent discussions at work, someone referred to a trampoline function. I have read the description at Wikipedia. It is enough to give a general idea of the functionality, but I would like something a bit more concrete. Do you have a simple snippet of code that would illustrate a trampoline? ...

N-ary trees in C

Which would be a neat implemenation of a N-ary tree in C language? Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example: struct task { char command[MAX_LENGTH]; int required_time; }; ...