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 / Converting char* to float

Author
Message
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 27th Dec 2005 15:55
How can I use the input I get to create a matrix?
Im trying this, but I cannot convert from char* to float.

I tried dbInt() but it didnt work.

Vlad
19
Years of Service
User Offline
Joined: 5th Oct 2005
Location:
Posted: 27th Dec 2005 16:13 Edited at: 27th Dec 2005 16:16
Hope this helps, never tested it though. Just had a fain idea I had seen it somewhere so I googled it.

EDIT: Wait a sec, this is not it, let me try again.
EDIT NÂș2 ( in less than 1 minute ):

http://www.sourcepole.com/sources/programming/cpp/cppqref.html

Make a find in that doc for "STDLIB.H, CSTDLIB (Misc. functions)"

It's right there.

Good luck.

V

I'm pretty sure I know everything. Doubts are something rare in me and I am never wrong, as this signature can prove.
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 27th Dec 2005 16:35
the command you want is atof() - its contained in stdlib.h and maths.h I belive.

would convert a char to float, example:

char szFloat[2] = "42 ";
float fFloat = atof(szFloat);
dbPrint(fFloat);

//output: 42.000000

indepth refrance: http://www.cplusplus.com/ref/cstdlib/atof.html

Login to post a reply

Server time is: 2024-11-19 03:44:12
Your offset time is: 2024-11-19 03:44:12