c

What are the current challenges of the D programming language?

I'm wondering how mature and stable D is, and if it might be a good replacement for C/C++. I know that there are currently two standard libraries (Phobos and Tango), so I assume that there might be people trying to unify them. Additionally I heard some time ago that the languages has problems on the boundaries of GCed/non-GCed code. I ...

need a flowchart

i have to make a program which has a structure name book . it includes name of book author and other details of the book.i have to make a menu driven program which has options to : Add a book delete a book sort books etc I know how to proceed but i cant imagine how would i make a function to add a book.plx give me a flow of the prog ...

Is there any way I can make g++ only emit warnings pertaining to my files?

I like to compile my code with -Wall, and sometimes even -pedantic. It's partly a style thing, and partly the fact that it does occasionally emit very, very useful warnings (such as using = rather than ==). However, the writers of some of my headers are clearly not such sticklers. Compiling with either of the two warning levels yields ...

Tool for modifying dynamic section of an ELF binary

Is there a tool for modifying the shared library entries in the dynamic section of an ELF binary? I would like to explicitly modify the shared library dependencies in my binary (i.e. replace path to existing library with a custom path) ...

Linked stack in C. Pop causes segmentation fault, but Push does not!

Hey everyone, I'm doing some simple stuff, so hopefully this question can be easily answered easily. I'm using gcc to compile. The push works perfectly fine. The problem is the pop. I get a segmentation fault whenever I compile and run it. Here are the pop and push functions: int push(stack *stk, int data) { stk->head = makeNod...

search algorithm on large files

I need help in deciding with search algorithm to use for searching large files. here is what I am doing. Lets say file consists of time range t1 to t2. (t2>t1) I need to get file offsets (fseek) of: time t3 that is bigger than t1 time t4 that is smaller than time t2 | ------| ---|----------------| t1 t3 t4 t2 ...

bitwise shifiting question

if i have int temp=(1<<31)>>31. How come the temp becomes -1? how do i get around this problem? thanks ...

pthreads with real time priority

I need to manage a pool of threads having different priorities, so I wrote the following thread startup procedure: static int startup(thrd_t *thrd, thrd_sync_t *sync, int prio) { pthread_attr_t attr; int err; struct sched_param param = { .sched_priority = prio }; assert(pthread_attr_init(&attr) == 0); as...

C standard library corner case

Is the following program a valid C program? #include <stdio.h> int main() { fwrite("x", 1, 1, stderr); fflush(stderr); fgetc(stderr); fwrite("y", 1, 1, stderr); return 0; } Notice that I try to read from stderr. When I compile it in Visual C++ 2008, and run it, I get the following output: xy which makes sense....

General purpose library for standard C?

Is there any widely known general purpose library for standard C. I'm thinking of something like what Boost is for C++. I found the C POSIX library... any other? ...

_fopen$UNIX2003 referenced from OpenSSL problem

Hi, I'm using compiled openssl for an iphone app, I followed instruccions here http://www.x2on.de/kontakt/ so I could develop rsa operation on iphone simulator. the problem is that I get this error when building the proyect _fopen$UNIX2003 referenced from _BIO_new_file in libcrypto_i386.a(bss_file.o) _file_ctrl in libcrypto_...

How to get rid of label used but not defined

I'm trying to print the rows of a table in embedded sql. I have this code where publication is the table and pubid is the attribute. I tried this: EXEC SQL DECLARE C1 CURSOR FOR SELECT pubid FROM publication; EXEC SQL OPEN C1; EXEC SQL WHENEVER NOT FOUND GOTO close_c1; for(;;) { EXEC SQL FETCH C1 INTO :pubid; ...

What is meant by Octet String ? Diff b/w Octet and Char ?

What is the difference between octet string and char ? how octet string can be used ? can anybody write a small C program on Octet string.How octet strings are stored in memory ? ...

c/objective-c question

I am truing to use a c function in a .c file from within my objective-c class. I have imported the header for the c file. but I am still getting a problem and my program would not compile. Undefined symbols: "gluUnProject(float, float, float, float const*, float const*, int const*, float*, float*, float*)", referenced from: -[GL...

C strings pointer vs. arrays

Possible Duplicate: What is the difference between char s[] and char *s in C? Why is: char *ptr = "Hello!" different than: char ptr[] = "Hello!" Specifically, I don't see why you can use (*ptr)++ to change the value of 'H' in the array, but not the pointer. Thanks! ...

Use fprintf to memory stream

I have a vc++ method that uses fprintf to write values to a file in the hard disc. I want to change this method so that instead of writing the values to disc, I want to return a pointer to the data. I know in advance the size I have to allocate. Is there any way to pass a memory stream or unsigned char pointer to fprintf? thanks ...

Why doesn't POSIX mmap return a volatile void*?

Mmap returns a void*, but not a volatile void*. If I'm using mmap to map shared memory, then another process could be writing to that memory, which means two subsequent reads from the same memory location can yield different values -- the exact situation volatile is meant for. So why doesn't it return a volatile void*? My best guess is ...

C: Multiple forks

Hi I need to use shared memory and fork to do this: Multipling random 512x512 matrixes using 4 processes and shared memory. I know how to fork one child but How can I fork 4 processes that do 1/4 of work? Thanks ...

Using conditionals in automake

I recently switched from using Makefiles to using Automake, and I can't figure out how to write the following simple if statement using automake: DEBUG ?= 1 ifeq (${DEBUG},1) CXXFLAGS:=$(CXXFLAGS) -g else CXXFLAGS:=$(CXXFLAGS) -O3 -DNDEBUG endif Is this even possible to do if I'm using automake? Since it generates the makefile from au...

Adding custom code to a Makefile generated by Automake

Suppose I want to add a runtime conditional to a Makefile generated by Automake. Is there any way to tell Automake about this conditional? ...