Writing numbers to a file

Just starting out? Need help? Post your questions and find answers here.
Toris
User
User
Posts: 16
Joined: Mon May 05, 2003 6:59 pm

Writing numbers to a file

Post by Toris »

Hi,
I've been trying to work out how I can write a value from a text box (numerical) into a file.
Say I have a text box that contains "859", I want to be able to write that value to a file.
I have tried both:
WriteWord(GetGadgetText(1))
and:
WriteWord(Int(GetGadgetText(1)))
Neither of which produce the correct value, the first, always seems to produce a value of 0x4800 or 0x4900, and the second, always produces 0x0000.
If I write the number directly, for example:
WriteWord(859)
That produces the correct value...
So, is there any way to write the number in the text gadget to a file?
Also... is there any way to write it as an unsigned number, instead of signed?

Many thanks,
Toris
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

WriteWord(Val(GetGadgetText(1))) should be the solution.
Also WriteString(GetGadgetText(1)) should work. :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Toris
User
User
Posts: 16
Joined: Mon May 05, 2003 6:59 pm

Post by Toris »

That works perfectly!
Thanks! :D
Post Reply