Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Error In (http://www.go4expert.com/forums/error-in-t18506/)

fob500 13Jul2009 01:32

Error In
 
Hi i have just started to read 'beginig unix programming' .Here is a sample code given in the book

Code: C

#include  <unistd.h>
#include  <sys/stat.h>
#include  <fcntl.h>
#include  <stdlib.h>
#include<stdio.h>
int main()
{
    char c;
    int in, out;
    in = open(“file.in”, O_RDONLY);
    out = open(“file.out”, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
    while(read(in,&c,1) == 1)
         write(out,&c,1);
return 0;
}

when i try to compile it the following errors are being displayed..
Code:

gcc -o 1 1.c
1.c: In function ‘main’:
1.c:10: error: stray ‘\342’ in program
1.c:10: error: stray ‘\200’ in program
1.c:10: error: stray ‘\234’ in program
1.c:10: error: ‘file’ undeclared (first use in this function)
1.c:10: error: (Each undeclared identifier is reported only once
1.c:10: error: for each function it appears in.)
1.c:10: error: stray ‘\342’ in program
1.c:10: error: stray ‘\200’ in program
1.c:10: error: stray ‘\235’ in program
1.c:11: error: stray ‘\342’ in program
1.c:11: error: stray ‘\200’ in program
1.c:11: error: stray ‘\234’ in program
1.c:11: error: stray ‘\342’ in program
1.c:11: error: stray ‘\200’ in program
1.c:11: error: stray ‘\235’ in program

can sum 1 tell whatz going on.Im running this program fron Desktop where i create the file.in which is being copied to file.out in this program.Thanx in advanceC Program

shabbir 13Jul2009 09:27

Re: Error In
 
Duplicate of Help With Error In C Program. Thread closed. Avoid creating the same thread over and over again


All times are GMT +5.5. The time now is 05:31.