Open files in program

BlitzPlus Forums/BlitzPlus Programming/Open files in program

aab(Posted 2004) [#1]
Hmmm. I have no idea how to do this:
Make it that when you double click on the icon for your file type (which works exclusively to your program), that it then opens your program (done that bit so far) and then reads that file, and sets up the file accordingly, rather than opening a new file in the program.
Anyone?


soja(Posted 2004) [#2]
Use CommandLine().
The file you double-clicked on will be the first parameter.


aab(Posted 2004) [#3]
Thanks!
It works when i put the filename as the command line, but doesnt when i open a file: It states 'Invalid Stream Handle'
I'll give it a good look over to see what i've done wrong
(probably variables mixed/localised or something hastily stupid like that...)

Edit: hmm. couldnt find the problem.
Alright, Heres my code (sampled):


Like i have said, it works within Blitz, but once compiled, fails to work......Help


soja(Posted 2004) [#4]
Problem solved. Insert this line before you try to open the file:
mapfilename=Trim(Replace(mapfilename, Chr$(34), " "))

Readfile doesn't like the quotes -- it was as if you were calling Readfile(""file"") and it didn't like that.


aab(Posted 2004) [#5]
Thanks again!!
Ill be using that piece of code in everything i read!