Hello
I am programming in c
I am trying to use sscanf on a string
the sting looks like the following
{'2', '5', EOF, EOF, EOF, EOF, EOF, EOF, EOF, EOF}
I am trying to read a float
I get a segmentation fault. Any ideas why?
quick sscanf question in c
Started by DaCapo, Nov 29 2007 06:31 PM
3 replies to this topic
#1
Posted 29 November 2007 - 06:31 PM
|
|
|
#2
Posted 30 November 2007 - 05:30 AM
DaCapo said:
the sting looks like the following
{'2', '5', EOF, EOF, EOF, EOF, EOF, EOF, EOF, EOF}
I am trying to read a float
I get a segmentation fault.
{'2', '5', EOF, EOF, EOF, EOF, EOF, EOF, EOF, EOF}
I am trying to read a float
I get a segmentation fault.
Segmentation fault occurs when the memory allocated is not enough or is done improperly.
Why not read char when you are reading a string.
EOF is a macro constant definition. It expands to a negative integral constant expression.
Size does matter for science and its laws changes accordingly.
[SIGPIC][/SIGPIC]
An C
[SIGPIC][/SIGPIC]
An C
#3
Posted 30 November 2007 - 09:33 PM
I actually just fixed the segmentation fault, sry bout that. But I still have a problem, whenever I do sscanf the value returned is not 25, it's some random value that changes everytime
#4
Posted 30 November 2007 - 09:36 PM
I fixed it, sorry, it was a really dumb error, I was trying to read a float to a char.


Sign In
Create Account

Back to top









