Use of fgets, puts, rewind in Gtk+



Hello,

I wished to read a file and get some lines from there like this:
        -----
        fp=fopen("filename", "r");
        for(k=0; k<8; k++){
                n=a[k];
                for (i=1; i<=n; i++) //Here 'n' is the line number
                        fgets(s, 100, fp);
                puts(s);
                rewind(fp);
        }
        -----
        -----
This is the code snippet, which is working so well after compiling with 'gcc' compiler, but when I added this code inside Gtk+ callback.c, a runtime error is occuring before execution of 'fgets'. I have already included 'stdio.h', but even then it is not executing.

Do you have any idea that how to overcome this problem?

Thanks & regards,
Sucheta Ghosh
Indian Statistical Institute, Kolkata



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]