FREE TUTORIALS ON C programming

Saturday, January 25, 2014



#include <stdio.h>


int main(void)

{
    char buffer[256];
    FILE * myfile;

    myfile = fopen("some.txt","r"); //opens and file for reading

    while (!feof(myfile))  //tests whether end of file is reached and continues to read as long as end is not reached
    {
        fgets(buffer,256,myfile);
        printf("%s",buffer);
    }

    fclose(myfile);
    
    return 0;
}

11:48 PM   Posted by Unknown with No comments

0 comments:

Post a Comment

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter

Search