Posted on 2003-03-10
Here is my problem:
I got a text file which contains other text file's name (one by line)
When I loop through the file with fget to read each filename, and then pass this filename to fopen, it give me a seg fault because of the newline char fget reads. So I first though to use fscanf instead of fget and worked well until I realize it wouldn't read filename containing space and also, it doesn't read 'til the eof like fget did.
So my question is how can I remove the new line char read by fget?
I thought I could use strncpy(dest, source, strlen(source) - 1) but it didn't work :(