All pastes #1047495 Raw Edit

Something

public c v1 · immutable
#1047495 ·published 2008-06-14 05:32 UTC
rendered paste body
//Nano's first official txt reader.  By nano - a.k.a programming god.#include <stdio.h>#include <string.h>#include <unistd.h>int main(void){    for(;;) //main loop.  main job.    {        askforfile();   }   system("pause");    //fclose(file);   return 0; }/***************askforfile()***************/ int askforfile() ///File location procedure.{           char txt_file[256]; //location    char text[25];  //text to read from file    char* ext = ".txt\0";        printf("\nFile?: ");    scanf("%s",txt_file);    FILE *file = fopen(txt_file, "r");    //where i learn stat    struct stat filesz; //29 C:\Dev-Cpp\readfile.c storage size of 'fileszz' isn't known     stat(txt_file,&filesz);    printf("\nSize of file is %d.\n",filesz.st_size);    malloc(sizeof(file + 1));        if(strstr(txt_file, ext))    {       file;             if ( file == NULL)       {           printf("Error in locating file.\n");           askforfile();       }        while(fgets(text, 100, file) != NULL ){                            printf("%s: %s",txt_file,text);                          }                       fclose(file);    }     else{         printf("\nEnter txt file...\n\n");         askforfile();         }     }