c

Have my makefile show me compile errors?

exedarken: darken.c gcc -o exedarken darken.c exeimagestats: imagestats.c gcc -o exeimagestats imagestats.c exelighten: lighten.c gcc -o exelighten lighten.c exerotate: rotate.c gcc -o exerotate rotate.c exeflip: flip.c gcc -o exeflip flip.c exematte: matte.c gcc -o exematte matte.c Theres my makefile. Is ...

Getting file modification time on UNIX using utime in C.

I have been told by a professor that you can get a file's last modification time by using utime.h. However, the man page seem to cite that utime() only sets this value. How can I look up the last time a file was changed in C on a UNIX system? ...

Microsoft API for parallel programming in C

Hi, Is there any Microsoft API for parallel programing in C language ? thanks for any answers, bye ...

data is null when reding from the .wav file in iphone?

I am trying to read the .wav file and give the raw data as input to the FFT algorithm.I have used the following code to read the .wav file. char ChunkID[4], Format[4], Subchunk1ID[4],Subchunk2ID[4]; int ChunkSize,Subchunk1Size, SampleRate, ByteRate,Subchunk2Size; short AudioFormat, NumChannels, BlockAlign, BitsPerSample; short *Data; /...

Use static_assert to check types passed to macro

I unfortunately have several macros left over from the original version of my library that employed some pretty crazy C. In particular, I have a series of macros that expect certain types to be passed to them. Is it possible to do something along the lines of: static_assert(decltype(retval) == bool); And how? Are there any clever alte...

printf as argument of function

Usually usage of function: my_func("test"); Whether I can use this parameter so? my_func(printf("current_count_%d",ad_id)); int my_func(const char *key) ...

LoadImage is working differently based on win color setting

HI, I am using loadImage to load an 24bit bmp file and then try to get the bmp info hBitmap = (HBITMAP)LoadImage(NULL, "logo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE) GetObject( hBitmap, sizeof(BITMAP), &bm ); When I do the same operation with windows color display setting 32 hi color than i got ...

Software package for calculation of intersections of polyhedra in C/C++

There are many good packages for calculating the intersection of polygons. I have found the GPC library useful. I would like to compute intersections of polyhedra (piecewise linear boundaries) in 3D. Are there any good libraries in C/C++ for this? ...

How to initialise a pointer to pointer struct in C?

I have a struct which is a node, and another which is a list of these nodes. In the list struct, its an array of nodes, but instead of an array, it's a pointer to pointer with a size integer: typedef struct node { struct node *next; MyDef *entry; } Node; typedef struct list { Node **table; int size; } List; List *init...

First programming language to be taught - C or Python?

I know that there is a long debate regarding this matter. I also understand that this is strictly not a programming question. But I am asking here as this platform contains wide range of experts from different realms. When we got admitted in a Computer Science and Engineering(CSE) course in university, we were first taught C. The cours...

Why does this malloc not work in C?

Just trying to make a kind of hash table with each node being a linked list. Having trouble just initializing the space, what am I doing wrong? #include <stdlib.h> typedef struct entry { struct entry *next; void *theData; } Entry; typedef struct HashTable { Entry **table; int size; } HashTable; int main(){ HashTable *ml; ml =...

C - Checking for NULL values

I am coming across situations such as this: if(x == NULL) { printf(" The value of X is Null, exiting.."); return -1; } and this "situation" gets repeated many , many times..... laziness aside is there a better way to write this ? Cheers! ...

How to treat a struct with two unsigned shorts as if it were an unsigned int? (in C)

I created a structure to represent a fixed-point positive number. I want the numbers in both sides of the decimal point to consist 2 bytes. typedef struct Fixed_t { unsigned short floor; //left side of the decimal point unsigned short fraction; //right side of the decimal point } Fixed; Now I want to add two fixed point number...

Allocating memory to pointer structures inside structures

If I have a structure such as typedef struct _people { char *name; bool *exists; struct _people **citizens; } PEOPLE; How do I go about allocating memory so that people->citizens[0]->name is accessible? I've tried info->citizens = malloc(sizeof(PEOPLE *)*numbPeople); However when I try to access info->citizens->name I get th...

How to implement `memmove` in standard C without an intermediate copy?

From the man page on my system: void *memmove(void *dst, const void *src, size_t len); DESCRIPTION The memmove() function copies len bytes from string src to string dst. The two strings may overlap; the copy is always done in a non-destructive manner. From the C99 standard: 6.5.8.5 When tw...

C - Feof(stdin)-how to indicate end of input in Windows?

Hi I have this code int x,y,m; for(;;){ m=scanf("%d %d",&x,&y); if (m!=2 || m==EOF){ break; } else{ printf("/%d/%d/\n",x,y); } } if (feof ( stdin )){ printf("End of input\n"); }else if(m!=2){ printf("There was an error\n"); } Under linux ctrl+D indicates end of input , and for windows ctr...

problem in taking input for the char type in c.

hello i am having a trouble in taking input for the character type in c.the behavior of my source code is unusual. my code is: int n,i; char *ps; printf("Total no:"); scanf("%d",&n); ps=(char *)calloc(n,sizeof(char)); for(i=0;i<n;i++) { printf("Enter character %d:",i+1); scanf("%c",ps+i); } then as per my requirement it...

Book for pointers in C

Possible Duplicates: Where can I learn more about pointers? The Definitive C Book Guide and List Can anyone suggest me a book for pointers in C?I have many of the books but pointers is something which I still think I lack. ...

Correct way to find out if a service is running as the SYSTEM user

Hi All. What is the correct way to find out if a process is running as the SYSTEM user. I'm looking for a win32 C API to check for the system user. We used to check if the username was "SYSTEM", but since Windows Server 2008 R2 the SYSTEM user appears to be localised. I.e SYSTEEM on a Dutch system. I cant find much information about...

Second scanf is not working

hello i am having trouble with this c language code: char st[2]; printf("enter first value:"); scanf("%c", &st[0]); printf("enter second value:"); scanf("%c", &st[1]); So my computer didn't ask me to enter the second value, I mean to say that it only print the first printf statement then I enter a character and then it only pr...