P
pjlsr
It's close to twenty years since I used the C language and at that time
I was doing only floating point computational work, nothing with
strings or reading files. I tried to use fopen in the following manner.
a file name is entered by keyboard , fgets is used to read the name.
printf is used to confirm that the name was correctly read. Then
infile=fopen("filename","r") is used to open the file which very
definitly exists. It returns '0' as the ptr( I think that is the term),
which makes me suspicious. Then fgets is used to read a line from the
supposedly open file. This causes a stack error exception and a
stackdump.
I think fopen is where the problem is because it is supposed to return
a small positive integer. To me '0' is not a small positive integer.
I really don't want to get into installing c++ or something like that.
I currently using Gcc in CYGWIN to do the compiling.
Any suggestions anyone?
Pete
I was doing only floating point computational work, nothing with
strings or reading files. I tried to use fopen in the following manner.
a file name is entered by keyboard , fgets is used to read the name.
printf is used to confirm that the name was correctly read. Then
infile=fopen("filename","r") is used to open the file which very
definitly exists. It returns '0' as the ptr( I think that is the term),
which makes me suspicious. Then fgets is used to read a line from the
supposedly open file. This causes a stack error exception and a
stackdump.
I think fopen is where the problem is because it is supposed to return
a small positive integer. To me '0' is not a small positive integer.
I really don't want to get into installing c++ or something like that.
I currently using Gcc in CYGWIN to do the compiling.
Any suggestions anyone?
Pete