|
Post by tony on Jun 15, 2004 9:15:14 GMT -5
I have difficulty open a simple text file. I read the documentation but I still cannot open the file. See program
dim Ifile Dim Syy$ Ifile=OpenFileRead("\files\tony.txt") if FileError()<>"" then print FileError():end endif Syy$= readtext(Ifile,true) print Syy$
The error tells me the file must be in a subdirectory calles "Files".
In the Basic4Gl diectory there is a sub directory called "Programs". In the "Programs" directory there are subdirectories called "Files" , "Data" and "Sound". My file called "Tony.txt" is in "Files".
Tony.txt was created in NotePad and has one line in it ABC,DEF (carriage return) Please Help !!! tony
|
|
|
Post by NovaGene on Jun 15, 2004 10:58:03 GMT -5
This should fix the problem:-
Change:-
Ifile=OpenFileRead("\files\tony.txt")
To:-
Ifile=OpenFileRead("files\tony.txt")
Cheers! -Lucas Tan-
|
|
|
Post by AHBanen on Jun 15, 2004 14:45:20 GMT -5
Lucas, Tony, Please call me a nitpicker, but I would write it as: Ifile=OpenFileRead(".\files\tony.txt") In this syntax the dot means: the current directory, and thus the path and file are relative to it. IMHO the dot acts as a visual anchor that makes it easier to remeber what your starting point is. As I said, I'm a nitpicker... André
|
|