Re: finding file in program with created filename

new topic     » goto parent     » topic index » view thread      » older message » newer message

sixs wrote:

> If I run the statement
>  
>             Handler =
> open("C:\\Downloads\\abgte2\\DATA\\filename"&".txt","r")
> I get the file not found, -1.

If 'filename' is a variable then your code shoould look more like this:
open("C:\\Downloads\\abgte2\\DATA\\" & filename & ".txt","r")

Notice that 'filename' is located completely outside the double quotes.

Your original code is actually trying to open:
    C:\Downloads\abgte2\DATA\filename.txt

...where the phrase "filename" is literally part of the name of the file 
you are trying to open, and not the value of the variable by the same name.

HTH,
Carl

-- 
[ Carl R White == aka () = The Domain of Cyrek = ]
[ Cyrek the Illogical /\ www.cyreksoft.yorks.com ]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu