Makefile error on C program "expected ‘)’ before ‘{’ token" -


i error when try make makefile on following c program.

int main() {     char  filename_src[101], filename_dest[101];      printf("\nsource file: ");     gets_s(filename_src, 100);      printf("\ndestination filename: ");     gets_s(filename_dest, 100);      if(copy_file(filename_src, filename_dest) == 0)         printf("copy successful\n");     else         fprintf(stderr, "error during copy!");      copyfile( filename_src, filename_dest ); }  int copyfile( const char *test1, const char *test2 ) {     int infile, outfile;     ssize_t nread;     char buffer[bufsize];      if( ( infile = open(test1, o_rdonly) ) == -1 )       return (-1);      if( ( outfile = open(test2,o_wronly|o_creat|o_trunc,perm ) == -1)     {         close(infile);         return (-2);     }     /* read test1 bufsize chars @ time*/     while( (nread = read(infile, buffer, bufsize) ) > 0)     {         /*write buffer output file*/         if( write(outfile, buffer, nread) < nread )         {             close(infile);             close(outfile);             return (-3);        /*write error*/         }     }      close(infile);     close(outfile);      if( nread == -1 )       return (-4);              /*error on last read*/      else       return (0);               /*all */ } 

this c program. error "expected ‘)’ before ‘{’ token" when try make makefile on terminal. can tell me problem in code is?

thank

if  ( ( outfile = open(test2,o_wronly|o_creat|o_trunc,perm ) == -1)     ^ 2               1                                    1      2  

as can see parenthesis unmatched.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -