Jbob Johan
Jbob Johan

Reputation: 221

c stdio File in visual studio 2010

i am learning c, and i am trying to follow many of examples i could find on web

as i encounter problem accessing some of the stdio keywords and typedefs or types.

for instance

#include <stdio.h>

int main()
{
 File *f; ---->error : identifier "f" is undefined
 //or found via codeblocs intellisense i also tried filebuf

 filebuf *f; ---->error : identifier "filebuf" is undefined
 // though this would compile 
 getc('');
}

as it's not able to loacte File struct

Upvotes: 0

Views: 69

Answers (1)

machine_1
machine_1

Reputation: 4454

File should be changed to FILE.also getc function takes FILE pointer not '',and filebuf should be changed to _iobuf.

#include <stdio.h>

int main()
{
    FILE *f;

    //_iobuf *f; 

    f = fopen("somefile","r");

    getc(f);
}

Upvotes: 1

Related Questions