[Gambas-user] Directories?
Rolf-Werner Eilert
eilert-sprachen at ...221...
Fri Dec 4 08:43:10 CET 2009
Dave Merriman schrieb:
> Is there a way to determine what directory a Gambas executable is run
> from? Or what its 'default' directory is when looking for a file?
>
> I've got some text files that I need to read into an array (I *really*
> wish Gambas had an easy way to embed array data _in_ the program, like
> the old "data 4, 17, 32, 88..." of BASIC days), and need to know where
> to put them so they're easily found.
>
In this case, I think Application.Path will be your friend. Type it and
press F2 while cursor is on Path, you'll get
Application.Path (gb)
Syntax
STATIC PROPERTY READ Path AS String
Returns the application path, i.e. the directory where it resides.
As to DATA I agree - but there are a lot of ways you can handle this, e.
g. by putting your data in strings or string arrays. The most practical
way I found is putting such data into files with lines separated by TABs
(chr$(9)).
You can then easily read the file by File.Load into a string, split it
into a string array by using Split with chr$(10) and work on each line
by using Split with chr$(9). This works as fast as a DATA line would.
Rolf
More information about the User
mailing list