How do you read in values from a file Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Ste2008
Knows some wx things
Knows some wx things
Posts: 47
Joined: Mon Mar 10, 2008 11:18 am
Location: Ireland

How do you read in values from a file

Post by Ste2008 » Mon Mar 31, 2008 11:13 pm

Hi i am currently creating a Textctrl box and am looking to read in values from a file, I dont want to display everything in the file at once i.e using the function Load file
I would like to be able to read in either a line or single values if possible and store them in a variable which i can then use to display in the text box as i need to
Thanx in advance
Ste

ArKay
Knows some wx things
Knows some wx things
Posts: 41
Joined: Wed Mar 26, 2008 1:38 pm
Location: Germany

Post by ArKay » Tue Apr 01, 2008 1:13 am

Depends. If the file isn't too big maybe wxTextFile could be of use.

http://docs.wxwidgets.org/stable/wx_wxt ... wxtextfile

lester
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Sep 02, 2006 7:24 pm
Location: Ukraine

Post by lester » Tue Apr 01, 2008 6:09 am

wxFFile?

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Tue Apr 01, 2008 9:49 am

Hi,

wxFFile leaves you doing all the work. wxTextFile would be fine for adding lines, but doesn't help with shorter strings or other values.

Your best choice would be wxTextInputStream, which knows about all these things. http://docs.wxwidgets.org/stable/wx_wxt ... tream.html

Regards,

David

Post Reply