[Advice]Simple open text & display code [Plain C]

Soldato
Joined
9 Dec 2006
Posts
9,289
Location
@ManCave
I’m trying to do something very simple but it is not working for me. I’m trying to read a txt file & display the contents on the screen,
I’ve used the example in my book, but don’t work

Error I’m getting: 'fopen' : function does not take 2 arguments

This is my code

Code:
Case 0x3E: //F4
       FILE *fopen(),  *fp;
    int c;
    fp = fopen("log.txt","r");
    c = getc(fp)  ;
    while (c!= EOF)
     {
              putchar(c);
             c =  getc(fp);
 }
     fclose(fp);


I understand it cannot take too arguments, but I can’t see what’s wrong with it the , seem to be in the right places.

Any advice would be appreciated.
 
Back
Top Bottom