I am attempting to add a temporary IP address to a NIC using AddIPAddress when logged in as a non-admin user. The MSDN documentation for AddIPAddress states that ERROR_INVALID_HANDLE is returned as as error if the function is called by a non-admin user.
Given that I have preceeded the call to AddIPAddress with API calls to LogonUser() a...
What is the best way to resolve the following circular dependency in typedef-ing these structs?
Note the C language tag - I'm looking for a solution in standard gcc C.
typedef struct {
char* name;
int age;
int lefthanded;
People* friends;
} Person;
typedef struct {
int count;
int max;
Person* data;
} People;...
Hi people!!
I need to do a program that do this: given an image (5*5 pixels). I have to search how many images like that exists in another image, composed by many other images. That is, i need to search a given pattern in an image.
The language to use is C. I have to use paralell computing, to search in the 4 angles (0º, 90º, 180º and ...
Is there a way to enumerate the members of a structure (struct | class) in C++ or C? I need to get the member name, type, and value. I've used the following sample code before on a small project where the variables were globally scoped. The problem I have now is that a set of values need to be copied from the GUI to an object, file, a...
Optimizing a game we're developing, we're running into the phase where every CPU cycle won counts. We using radians for position calculations of objects circling around other objects and I want to cut the needless accuracy in my lookup tables. For that, we make heavy use of a predefined Pi. How accurate should this Pi be?
So, my questio...
What is the best implementation of Markdown for C or C++?
I found these via Google, and would appreciate comments about which ones work well and which ones don't (and which ones I may have missed):
peg-markdown
Discount
Cpp-Markdown
...
Could you recommend a good general purpose data container library for C (pure C, not C++)?
I just need basic structures, like dynamic arrays, hash tables, etc.
(Note: By "good" I mean fast + elegant interface).
...
Hi,
If I were to program a microcontroller (ATMega128) to play a realtone with a speaker, how would I do this? Do I need to use a digital/analog converter to send different amplitude values, or is it enough with frecuency changes? In any case, how would I encode the frecuency/amplitude values that the speaker needs to receive? Do I need ...
What's the difference between:
char * const and const char * ?
UPDATE: char * const instead of const * char
...
Can someone show me a really simple Python ctypes example involving Unicode strings including the C code?
Say, a way to take a Python Unicode string and pass it to a C function which catenates it with itself and returns that to Python, which prints it.
...
If I have a union, C standard guarantees that the union itself will be aligned to the size of the largest element.
union U {
long l;
int i;
short s;
char c[2];
} u;
But what does it say about alignment of individual union elements inside the union? Is the following expression guaranteed to be true?
(&u.l == &u.i) && (...
Hi all
I am facing a strange problem. I am using sprintf or swprintf according to the build defines with or without unicode. I have wrapped these functions in my own function like this:
int mysprintf( MCHAR* str,size_t size, const MCHAR* format, ... )
{
#ifdef MYUNICODE
return swprintf( str, size, format);
#else
return snprintf...
I'm writing a recursive function that takes a char array, which represents a number, and a pointer to a digit in that array. The point of the function is to increment the number just like the ++ operator. However, when I try it out on the number '819'. It doesn't increment it to '820' but instead changes it to '810' (it increments the...
Anyone know of a script to get a listing that will be able to tell me the most frequently called functions for a C project?
method1 391
method2 23
method3 12
Even better have it be customizable to require a keyword in the method name "get".
I'm trying not to reinvent the wheel and write a simple script to do it myself. Probably an ea...
hi,
I am in a big problem ..i have compiled my c files using linux make file in Linux OS.
I want to compile the same files in Windows using the same make file by command prompt. For that i have nmake utility and Cygwin utility too.
I have done that successfully with simple programs with simple make file ..
But it is not possible to c...
If I got a file descriptor (socket fd), how to check this fd is avaiable for read/write?
In my situation, the client has connected to server and we know the fd.
However, the server will disconnect the socket, are there any clues to check it ?
...
Someone ask me to help them extract their pictures from a Web Shots image collection file (.WBC). I tried XnView but it did not work. How can I do this in C?
...
Pay attention carefully because this is a hell of a question ;-)
I want to use template functions for generic collection actions (like search, foreach, etc.) in C while maintaining compiler static type checking. It is fairly straightforward while you're using simple callbacks like in this example:
#define MAKE_FOREACH(TYPE)\
void forea...
Whenever I look at real code or example socket code in books, man pages and websites, I almost always see something like:
struct sockaddr_in foo;
memset(&foo, 0, sizeof foo);
/* or bzero(), which POSIX marks as LEGACY, and is not in standard C */
foo.sin_port = htons(42);
instead of:
struct sockaddr_in foo = { 0 };
/* if at least o...
Hello,
I read the example on "Passing multi-dimensional arrays in C" on this site.
It is a great example using char arrays, and I learned a lot from it. I would like to do the same thing by creating a function to handle a dynamically allocated one-dimensional integer array, and after that, create another function for handling a multi-...