c

Installing bitarray in Python 2.6 on Windows

I would like to install bitarray in Windows running python 2.6. I have mingw32 installed, and I have C:\Python26\Lib\distutils\distutils.cfg set to: [build] compiler = mingw32 If I type, in a cmd.exe window: C:\Documents and Settings\john\My Documents\bitarray-0.3.5>python setup.py install I get: [normal python messages skipped] ...

Cross-platform memory allocator sbrk/virtualalloc

I am wondering if there is a cross-platform allocator that is one step lower than malloc/free. For example, I want something that would simply call sbrk in Linux and VirtualAlloc in Windows (There might be two more similar syscalls, but its just an example). ...

Using fseek to backtrack

Is using fseek to backtrack character fscanf operations reliable? Like for example if I have just fscanf-ed 10 characters but I would like to backtrack the 10 chars can I just fseek(infile, -10, SEEK_CUR) ? For most situations it works but I seem to have problems with the character ^M. Apparently fseek registers it as a char but fscan...

winapi: CreateProcess but hide the process' window?

I am using CreateProcess to create a cmd.exe process that is passed a parameter that it executes and quits, this makes command prompt flash up on the screen. I tried to avoid this by setting STARTUPINFO struct wShowWindow to SW_HIDE but this parameter seems to affect the calling window, not the window for the process that gets executed...

String input to flex lexer

I want to create a read-eval-print loop using flex/bison parser. Trouble is, the flex generated lexer wants input of type FILE* and i would like it to be char*. Is there anyway to do this? One suggestion has been to create a pipe, feed it the string and open the file descriptor and send to the lexer. This is fairly simple but it feels ...

C/C++: Static function in header file, what does it mean?

I know what it means when declared in source file. I reading some code, find that static function in header files could be invoke in other files. ...

How to get the uuid of the mainboard with c.

I need a code snippet for reading the mainboard uuid in c (in Windows XP and Windows Vista if there is a difference, else just for Windows). ...

Per thread memory allocation

Hello, I am working on a trace tool for multithread applications, more especially about memory allocation. I would like a per thread memory allocation. I know that when a thread do a malloc, the memory used is the global heap. I would like to trace which thread allocated how much memory. I did a wrapper upon malloc, incrementing value...

stack not workingin gdb

Exact duplicate: http://stackoverflow.com/questions/780961/gdb-gnu-debugger #include <pthread.h> #include <stdio.h> #define NTHREADS 4 #define N 1000 #define MEGEXTRA 1000000 pthread_attr_t attr; void *dowork(void *threadid) { double A[N][N]; int i,j; long tid; size_t mystacksize; tid = (long)threadid; pthread_...

socket:client waiting even after recieving last byte

I have client/server program in C, through which I am transferring files to the client from server. But the client is waiting for recv even after receiving the last byte of the file. Client is terminating only if I kill it or server is killed by me. But server has to be in a loop as it to has to entertain the request of other clients. ...

Char to int conversion in C.

If I want to convert a single numeric char to it's numeric value, for example, if: char c = '5'; and I want c to hold 5 instead of '5', is it 100% portable doing it like this? c = c - '0'; I heard that all character sets store the numbers in consecutive order so I assume so, but I'd like to know if there is an organized library fun...

Any way to change linking to avoid the LD_PRELOAD on HPUX?

I think I understand why I need LD_PRELOAD set when loading a multithreaded applicatoin that loads a single threaded library that loads libcl.2 but I was wondering if I could use some linker setting to avoid this. Any help appreciated. Update: Perl loads dynamic /usr/lib/libc.2 Perl loads DB2.sl DB2 Attempts to loa...

input string through scanf

i wanted to ask is there way to input blank in string through scanf, i am using this [^\n] to input what so ever excluding newline .is it correct ?but is creating lot of problem as it seems to be stored in the input buffer.what is the best way to input string .both gets and fgets are creating lot of problems, while(strcmp(buf,"q...

supressing blankspace in input through scanf

to supress newline we use %[^\n].can you suggest what should be the format to skip blank in the input,ie if we have to input "hallo stackflow".i know fgets and gets but i dont want to use them ,they are creating problem. ...

Warning with nftw

Hi, I'm trying to use the nftw to process some files under a directory #include <ftw.h> #include <stdio.h> int wrapper(const char * fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { printf("File %d\n", ftwbuf->base); return(0); } int main(int argc, char ** argv) { const char *name; int flags = 0; n...

Beginners guide for setting up emacs with gcc/gdb?

I looked around the GNU emacs material and didn't find anything helpful. Does anyone know of a good tutorial for setting up emacs, to basically turn it into an IDE? I'm looking for interfacing with gcc/gdb/make, etc... ...

C to Fortran calling problem

Using Visual Studio 9 on Windows 64 with Intel Fortran 10.1 I have a C function calling Fortran, passing a literal string "xxxxxx" (not null terminated) and the hidden passed length arg 6. Fortran gets it right since the debugger recognizes it's a character(6) var and has the correct string, but when I try to assign another Fortran cha...

Pointer issue in C

Greetings, I am trying to learn pointers in C, I simply want my "addtwo" function to add 2 to every element of the input integer array, yet I get odd compilation errors, here is the non-pointer version which indeed won't properly compile. addtwo(int *arr[]) { int i=0; for(;i< sizeof(arr)/sizeof(int);i++) { arr[i] = arr[i...

Quick brush-up on C++ for a C/Obj-C programmer?

I'm being offered a C++ job and need a quick brush-up project so I can become fluent in the language again. Currently I develop iPhone applications and became fluent in C/Obj-C from a background of Python, Java and C# in a matter of days. I'm looking for an idea for a small project, or a brush-up sort of course online that I can complete...

Trying to get started in C

Does anyone know any good resources with tasks or problems to get practice in things that are "new" in C from the point of view of someone with experience in high-level languages like C# and PHP? All I can seem to find are more "challenges" than problems for practice. Thanks. ...