Results 1 to 3 of 3
hi ,
FILE *cs;
cs = fopen(files[target-1]->d_name,"r");
fread(&buf1,65000,1,cs);
here cs is a pointer for files in directory, my code was working perfectly , but now after a week i am ...
- 05-26-2008 #1Just Joined!
- Join Date
- May 2008
- Posts
- 4
fread(&buf1,65000,1,cs);, segmentation fault
hi ,
FILE *cs;
cs = fopen(files[target-1]->d_name,"r");
fread(&buf1,65000,1,cs);
here cs is a pointer for files in directory, my code was working perfectly , but now after a week i am executing , it shows segmentation fault in fread
pleeez need urgent help
thanks in advance
shash
- 05-29-2008 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
That portion of code tells us exactly nothing about the problem. Writing a line for fopen of fread is a simple as looking at the man page for those instructions and copying the relevant line to change the values afterwards. So, even the beginners can do that ok.
Another matter is where is pointing every pointer, and for that we need to see more. Note also that, unless you are working at byte level and with void types, you should be using something like 65000*sizeof(<type>) instead. But I assume that's correct for your program
- 05-31-2008 #3Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
What did you do to the program between when it was working and when it stopped?


Reply With Quote