Page 1 of 1

Read a file with a variable in the filepath.

Posted: Thu Sep 25, 2003 11:19 am
by doraemon
I need to make something like this:

;ReadFile(#FileModel , "Dades\" && Marca$ && ".txt")

Marca is a variable selected by a ComboBoxGadget.

Anyone can sayme the correct way to make it??

Carles "Doraemon" Bernardez

Posted: Thu Sep 25, 2003 11:22 am
by freedimension
Perhaps

Code: Select all

ReadFile(#File, "Dades" + marca$ + ".txt")

Posted: Thu Sep 25, 2003 11:36 am
by doraemon
freedimension wrote:Perhaps

Code: Select all

ReadFile(#File, "Dades" + marca$ + ".txt")
It do not run fine :(

exaple of the datas:
MyProgram:dades/alcatel.txt
"" dades/nokia.txt
"" dades/sony.txt
........

Posted: Thu Sep 25, 2003 11:47 am
by dmoc
Have you got a "/" in there somewhere?

If I suspect problems with paths I construct it in a variable, eg,

fp.s = path+file

then check it using...

debug ">"+fp+"<"

and then it should be clear where the problem is.

Posted: Thu Sep 25, 2003 12:39 pm
by Kale
Remember the slash after the folder name:

;ReadFile(#FileModel , "Dades\" && Marca$ && ".txt")

becomes:

Code: Select all

marca$ = "alcatel"
;or marca$ = "nokia"
;or marca$ = "sony"
ReadFile(#FileModel, "Dades\" + marca$ + ".txt")

Posted: Thu Sep 25, 2003 12:55 pm
by freedimension
Yeah, I forgot the Slash