Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbWriteFloat and dbReadFloat

Author
Message
Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 4th May 2006 03:26
I can't figure out if I am doing something wrong, or this is messed up. When I just do this


dbOpenToWrite(1,"test.txt");
dbWriteFloat(1,1000);
dbCloseFile(1);


and in test.txt it looks like this

zf

or something very close.

As far as dbReadFloat goes, I'm not having any luck either. If I do this

char *test;
dbOpenToRead(1,"test.txt");
test=dbReadFloat(1);
dbCloseFile(1);

then I come up with an extremely large number that is no where close to what it actually was.

I would just like to know what's going on here. Thanks

common people are walking in line.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th May 2006 13:21
It is possible the readFloat function doesn't work, but why are you using dbReadFloat like that ?

Web Site:http://www.nicholaskingsley.co.uk
Al:Tina wants me to pop out of her birthday cake, and guess what she doesn't want me to wear...
Kaiyodo
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: UK
Posted: 4th May 2006 15:43
I've just tested this myself and dbReadFloat works fine, but it returns a float not a char *. The dbRead/WriteFloat commands read and write the internal binary format of a float variable, not the text representation of it, that's why it's not readable in the text file either.

Kaiyodo.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th May 2006 19:25
Wow. You guys are using SDK file I/O, when you have the choice of using the standard C, C++ or Windows file I/O?

Wow, again.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th May 2006 21:01
I was just pointing his/hers/its dodgy use of functions - the time for bringing them around to using stdio i/o functions is later on

Web Site:http://www.nicholaskingsley.co.uk
Al:Tina wants me to pop out of her birthday cake, and guess what she doesn't want me to wear...
Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 4th May 2006 23:17
Oops. that was just me not think right while typing that. I am not actually using char*.
I will definatly not use the sdk file i/o if it's crap. Thanks for pointing that out for me.

common people are walking in line.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 5th May 2006 12:05
Theres nothing particularly wrong with the SDK I/O system - all it seems to call is fread/fwrite (or possibly _read & _write), so why waste a few milliseconds and not call the standard file routines yourself ?

Web Site:http://www.nicholaskingsley.co.uk
Al:Tina wants me to pop out of her birthday cake, and guess what she doesn't want me to wear...

Login to post a reply

Server time is: 2024-11-19 06:42:40
Your offset time is: 2024-11-19 06:42:40