What are the differences between poll and select?
I am referring to POSIX standard of select and poll system C API calls? ...
I am referring to POSIX standard of select and poll system C API calls? ...
What resources exist to aid in writing C/C++ code that works across multiple platforms and compilers? For example, I regularly find myself asking questions like: Which preprocessor macros are automatically defined in various compilers and environments? (e.g. __GCC__, WIN32, __WIN32__, __CYGWIN__) Which versions of compilers and standar...
Is the following supported across *nix platforms? #include <cstdio> #include <sys/types.h> #include <signal.h> #include <unistd.h> class SignalProcessor { public: static void OnMySignal(int sig_num) { printf("Caught %d signal\n", sig_num); fflush(stdout); return; ...
Say I have a pointer to some structure in a thread, and I want to pass it to the parent process via a pipe. Example: MyType * someType; I then want to cast someType to void * and put it on the pipe. How can it be done? ...
Over the past couple of days I have been reading into using autotools to build my project instead of the Makefiles I have pieced together over the past couple of months. Unfortunately I have not found an example that gave me enough insight towards how my project structure is currently. I have three libraries that are included in the app...
I have a main process that uses a single thread library and I can only the library functions from the main process. I have a thread spawned by the parent process that puts info it receives from the network into a queue. I need to able to tell the main process that something is on the queue. Then it can access the queue and process the ...
So far, I've been able to create a window in C, and add a button and edit box to that window. But, where can I find an exhaustive list of the system classes for all the form controls? I can't remember where I found BUTTON and EDIT--is there a LABEL? LISTBOX? CHECKBOX? COMBOBOX? etc. Then, how would I use those built in windows functions...
I'm currently working on the iPhone with Audio Units and I'm playing four tracks simultaneously. To improve the performance of my setup, I thought it would be a good idea to minimize the number of Audio Units / threads, by mixing down the four tracks into one. With the following code I'm processing the next buffer by adding up the samp...
To me, Intel syntax is much easier to read. If I go traipsing through assembly forest concentrating only on Intel syntax, will I miss anything? Is there any reason I would want to switch to AT&T (outside of being able to read others' AT&T assembly)? My first clue is that gdb uses AT&T by default. If this matters, my focus is only on any...
I need a simple lexical analyzer that reports for-loop errors in C/C++. ...
Hello, I have created a single linked list. Everything works fine. I just want to know if I have done anything potentially dangerous in my code. The code snippets I am concerned about is my push, pop, and clean-up. The parts of the code is just for user interaction so not really important (I posted anyway so that it was more clear in ...
What is the implication of "private unsigned char" in C? ...
Hi there, I've developed an own file format for configuration files (plaintext and line based -> EOL = one configuration) for an application. This format is nothing quit special and the only reason I do this, is to learn something! The reader and writer functions will be implemented in C (with GLib because it should be a UTF8 encoded fi...
I need to get the stack information of my C application in certain points. I've read the documentation and searched the Net but still cannot figure out how I can do it. Can you point to a simple process explanation? Or, even better, to an example of stack unwinding. I need it for HP-UX (Itanium) and Linux. Thanks ...
I'm writing some physics simulations in c for university, and now I output a series of hundreds of png that I then watch in fast sequence... is there a way to merge them to a video in c with some simple lossless codec library? P.S. I'm using cairo graphics and have very little experience in graphics programming in general ...
Consider this C construct that checks for errors before doing actual work: int function(struct Context *context,struct Connection *conn) { int retval; switch(0) { case 0: retval = BUFFER_INACTIVE; if(conn->mSocket == -1) break; retval = BUFFER_FULL; /* Is there enough room to add ? */...
Given a C project that needs to support multiple environments, how do I use the preprocessor to enforce that exactly one environment is defined? I can already do #if defined PROJA (blah blah blah) #elif defined PROJB (etc) #else #error "No project defined" #endif All that does, though, is tell me if 0 pro...
I have a piece of code with the following rough signature: void evaluate(object * this) { static const int briefList[] = { CONSTANT_A, CONSTANT_Z }; static const int fullList[] = { CONSTANT_A, CONSTANT_B, ..., CONSTANT_Z}; const int const * pArray; const int nElements; int i; if ( this->needDeepsEvaluation ) ...
As many young programmers do, I learned the usefulness of inserting numerous print-to-console statements of "here1," "here2," and so on at different points in code to figure out when my programs are going awry. This brute force debugging technique has saved me many, many times throughout my CS studies. However, when I started programming...
I want to code drivers in C in linux os, though I think its very tough. Can I get some hints as to how to start or books to follow? Drivers can be from my USB port to graphics card!! I know as to where I can search for books, I would like to know as to what the basic knowledge I should start with. Do I need to have hardware knowledg...