Hello,
I am pretty proficient with C++. However, I am new to plain C programming.
I am attempting to compile the following code on a UNIX system. For some reason I get error messages indicated in the first code block. The second code block is my code. Can someone point out what I am doing wrong? The error messages don't seem to make sense.
Code:"secImg.c", line 20: syntax error before or at: char "secImg.c", line 23: undefined symbol: i "secImg.c", line 23: undefined symbol: bufCode:#include <stdio.h> //for printf #include <fcntl.h> //for file open operations #define FILE_NAME_SIZE 256 //for the size of a character main(int args, char * argv[]) { char * nameBuff = (char *)malloc(sizeof(char) * 100); if(nameBuff != NULL) strcpy(nameBuff, "malloc worked\n"); else printf("malloc failed to allocate memory\n"); printf(nameBuff); free(nameBuff); char * buf = (char *)malloc(FILE_NAME_SIZE); int i; while(i = read(0, buf, FILE_NAME_SIZE)) { write(1, buf, i); } return 0; }



LinkBack URL
About LinkBacks


