[Gambas-user] Accessing Project Data in a Text File

Tobias Boege taboege at ...626...
Sun Feb 9 17:16:00 CET 2014


On Sat, 08 Feb 2014, Louis W. Adams, Jr. wrote:
> I have a project with a text file associated with it.  So there is a tab
> displaying the data imported into the project (?) from the text file.  How
> do I access the data?  Since the project is already aware of the data, I
> wouldn't think that it's necessary to Open the file and Read its contents as
> would be done if the file were not associated with the project.  If it was a
> graphics file all I'd have to do is load it into a Picture object.  Is there
> a similar way of loading a line of text into a string, or load the contents
> of the line into variables based on spaces/tabs/commas that separate data
> values?  Some of the data is text (strings of characters without
> spaces/tabs/commas), and some are numbers.  It is a UTF-8 file if that makes
> a difference.
> 

Are you talking about your project at design time in the IDE or when your
project runs, i.e. do you want to look at the file or does your program need
it at run time? I guess the second but it's not clear to me...

So you said, if it was a graphics file, you would *load* it into a Picture
object. Why do you then think it's unnecessary to load the text file? You
have to open and read it which can be done line-wise in at least two
comfortable ways:

1) File.Load() and Split()
2) Open and Line Input.

Look at the documentation.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list