Hello all!
I need a little help if someone has the patience.
At the moment i'm using Dev-c++ with windows XP however i'm experiencing
some odities which are a little ahead of my understanding.
you see i was writing a small program to overwrite files before i erase them
however whilst doing this i found that the fgets function was not reading the lines
of txt from the file correctly and that previous projects that had worked fine were
also going wrong. When i printf the contents of my array i find that each character
is followed my a null.....every single letter!!
heres my simple little code which gives the results described:
if its of any importance in was using notepad to write my txt files.Code:#include<stdio.h> main() { int i; char trial[50]; FILE *ptr; ptr=fopen("c:\\at.txt","r"); fgets(trial,200,ptr); printf("%s\n",trial); for (i=0;i<50;i++) {printf("%i,",trial[i]);} fclose(ptr); getchar(); return 0; }