Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,758 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Write float to file (file_flt_write) #209238
06/02/08 04:44
06/02/08 04:44
Joined: May 2008
Posts: 5
N
Newbie999 Offline OP
Newbie
Newbie999  Offline OP
Newbie
N

Joined: May 2008
Posts: 5
It would be nice to read/write more than 3 decimal place accuracy from/to an external file.

file_flt_write (for "float" values)
file_flt_read

file_dbl_write (for "double" values)
file_dbl_read

Re: Write float to file (file_flt_write) [Re: Newbie999] #212095
06/20/08 11:18
06/20/08 11:18
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
bump*

this would be great i was seaching for somthing like this
te=here is a workaround but it sucks

thx


"empty"
Re: Write float to file (file_flt_write) [Re: flits] #212107
06/20/08 13:33
06/20/08 13:33
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
workarounds never suck but prove that you're a programmer...

Code:
float f = 3.14159;
char* buf = (char*)&f;
var i;
for (i = 0; i < sizeof(float); i ++) {
    file_asc_write(file, (var)(buf[i]));
}


reading works accordingly. i haven't tested it, so if it doesn't work try left-shifting the var by 10:

Code:
    file_asc_write(file, (var)(buf[i]) << 10);


Last edited by Joey; 06/20/08 13:37.
Re: Write float to file (file_flt_write) [Re: Joey] #212113
06/20/08 13:49
06/20/08 13:49
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
i just dont like workaurond but the most easly workaurond of myself was

just take a string and change the string


"empty"
Re: Write float to file (file_flt_write) [Re: flits] #212118
06/20/08 13:57
06/20/08 13:57
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
take a string and change the string?

Re: Write float to file (file_flt_write) [Re: Joey] #212125
06/20/08 14:38
06/20/08 14:38
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
STRING* pl_id = "0000000001";

file_str_write(fhandle,pl_id);

now you can change pl_id and even add leters or other crazy stuff


"empty"
Re: Write float to file (file_flt_write) [Re: flits] #212265
06/21/08 07:46
06/21/08 07:46
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
crazy stuff such as addition, multiplication, division etc.?


Moderated by  aztec, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1