Hello,
I found out that using the Invocation API changes the behaviour of
printf/scanf (output of floating point numbers)
See the small test program appended. Can someone explain why this happens?
I remember that one had to set an environment variable (LOCALE or something
similar) on Solaris to steer the behaviour of scanf/printf. Is this also
necessary on Linux? The comma instead of the point looks like a floating point
in German format. Unfortunately I do not want to use this format.
See you
- Markus
---------------------------------------------------------------------------
#include <jni.h>
#define CLASSPATH ".:/usr/lib/jdk1.1.7/lib/classes.zip"
test()
{
char c;
float f;
int r;
r = sscanf( "10.0", "%f%c", &f, &c );
printf( "sscanf test: f == %f, c == '%c', r == %i\n", f, c, r );
}
main()
{
JNIEnv *Env;
JavaVM *Jvm;
JDK1_1InitArgs Args;
char Classpath[ 1024 ];
Args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs( &Args );
Args.classpath = CLASSPATH;
test();
if ( JNI_CreateJavaVM( &Jvm, &Env, &Args ) < 0 )
exit(1);
printf( "JVM created.\n" );
test();
(*Jvm)->DestroyJavaVM( Jvm );
}
---------------------------------------------------------------------------
> gcc -I/usr/lib/jdk1.1.7/include -I/usr/lib/jdk1.1.7/include/genunix
-L/usr/lib/jdk1.1.7/lib/i686/native_threads -ljava invoke.c
> a.out
sscanf test: f == 10.000000, c == '�', r == 1
JVM created.
sscanf test: f == 10,000000, c == '.', r == 2
>
---------------------------------------------------------------------------
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]