[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Desperate in need of help: Very very weird problem with sscanf after
From:       Sebastian =?iso-8859-1?q?Tr=FCg?= <trueg () kde ! org>
Date:       2009-08-19 13:16:36
Message-ID: 200908191516.36875.trueg () kde ! org
[Download RAW message or body]

I am lost here.
Consider this little app:

#include <stdio.h>
int main(int argc, char* argv[])
{
    const char* s = "-0.250000   0.750000";
    float a = 0.0, b = 0.0;
    sscanf( s, "%f%f", &a, &b );
    printf( "%f %f\n", a, b );
}

the output is this:
"-0.250000 0.750000"

BUT: as soon as I link libnepomuk to it the output changes to:
"-0,000000 0,000000"

The reason is that sscanf only reads "-0" and then stops.
I tried to look for evil "static" usage in libnepomuk. But even after 
disabling the unused static stuff the problem persists. I am at a loss.

What other than static variables could screw up a program like this?

Please enlighten me. :)

(attached a cmake file for simple testing)

Cheers,
Sebastian

["CMakeLists.txt" (text/x-cmake)]

set(SRC test.cpp)
add_executable(test ${SRC})
target_link_libraries(test nepomuk)

["test.cpp" (text/x-c++src)]

#include <stdio.h>

int main(int argc, char* argv[])
{
    const char* s = "-0.250000   0.750000";
    float a = 0.0, b = 0.0;
    sscanf( s, "%f%f", &a, &b );
    printf( "%f %f\n", a, b );
}


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic