-
as seen on Stack Overflow
- Search for 'Stack Overflow'
When I compile a simple Hello World! program that uses the sscanf function on my local Debian lenny x64, it works. But when I upload the same program to the server running CentOS x86, it will not work. If I do not use sscanf, then the program works on both computers.
gcc -std=c99 -O2 -pipe -m32
If…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have a function that makes a series of calls to sscanf() and then, after each, updates the string pointer to point to the first character not consumed by sscanf() like so:
if(sscanf(str, "%d%n", &fooInt, &length) != 1)
{
// error handling
}
str+=length;
In order to clean it up and…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm trying to convert a string to GUID with sscanf:
GUID guid;
sscanf( "11111111-2222-3333-4455-667788995511", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&guid.Data1, &guid.Data2, &guid.Data3,
&guid.Data4[0], &guid.Data4[1], &guid.Data4[2],
…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
For a project I'm trying to read an int and a string from a string. The only problem is sscanf appears to break reading an %s when it sees a space. Is there anyway to get around this limitation? Here's an example of what I'm trying to do:
#include<stdio.h>
#include<stdlib.h>
int main(int…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
This is a simple problem, but I can't see it:
char *s = "f 8.649292" ;
double d ;
sscanf( s, "f %f", &d ) ;
printf( "d is %f\n", d ) ;
Why is d not containing the double value 8.649292?
>>> More