segmentation fault when reading from streams
|
|
Bugzilla Link |
335 |
Created on |
Dec 11, 2006 18:06 |
Resolution |
FIXED |
Resolved on |
Dec 12, 2006 10:46 |
Version |
svn |
OS |
Linux |
Architecture |
PC |
Extended Description
I encountered a segmentation fault when trying to read a string from a text file
and sending it to StdIO. I am not sure wether this is my mistake (am I required
to allocate memory for strings?) or the compiler's.
Try this example:
use StdIO: all;
/* input example:
filename: 2DBild1.dat
dimension: 2
omega1: 64
omega2: 64
m1: 64
m2: 64
representation format: double
*/
int main() {
err, stream = fopen("text1.txt","r");
/* Try to read "filename:" */
s = fscans(stream,20);
printf(s);
fclose(stream);
return(0);
}