Posts: 17
Threads: 5
Joined: Aug 2003
ok i am writeing a program what is basicly a external script creator (for softwear called playerworlds) it will ask then questions and then add there awnser to the script where it belongs
but to cut to the chase i need to create a new file how would i do this?
Posts: 538
Threads: 62
Joined: Apr 2003
correct me if i'm wrong but you just save the file as normal as though it was there
url=http://www.spreadfirefox.com/?q=affiliates&id=0&t=79]
[/url]
Posts: 17
Threads: 5
Joined: Aug 2003
ohh and a nother question
i want it to come out in plain text will it do it auto maticaly and can i get some examples of what you mean GDM
Posts: 2,765
Threads: 138
Joined: Nov 2002
sorry a little off topic but, player worlds is not good. sorry again
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 199
Threads: 2
Joined: May 2003
To create a new file (like GDM said)
Code:
OPEN filename$ FOR INPUT AS #1
You can use other file access methods to create a new file (BINARY, RANDOM)
To put text into a file: If you've opened up a file for sequential input (as above), you can use this:
Code:
PRINT #1, "Crap you want to put in the file. Line by line"
It will put the string into the file... line by line.
so
Code:
PRINT #1, "Hello world"
PRINT #1, "is far too common for me"
PRINT #1, "to ever use"
would produce a file that looks like this
Code:
Hello world
is far too common for me
to ever use
HTH
~Phydaux
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79]
[/url]
END OF LINE
.
Posts: 2,765
Threads: 138
Joined: Nov 2002
why not this
Code:
PRINT "HI" + CHR$(13) + "BYE"
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 3,343
Threads: 83
Joined: Mar 2003
Well... it would be PRINT #1 for a start, and also you need a CHR$(10) and also if the line becomes longer than 256 characters you'll have trouble compiling it. But for short records you are right, it'll work fine.
Posts: 538
Threads: 62
Joined: Apr 2003
yes i was rite
wahoo
url=http://www.spreadfirefox.com/?q=affiliates&id=0&t=79]
[/url]
Posts: 199
Threads: 2
Joined: May 2003
Quote:why not this
Code:
PRINT "HI" + CHR$(13) + "BYE"
Well apart from all the problems Oracle mentioned, you can't stick commands between "HI" and "BYE" if you needed to.
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79]
[/url]
END OF LINE
.
Posts: 1,845
Threads: 44
Joined: Aug 2002
Quote:To create a new file (like GDM said)
Code:
OPEN filename$ FOR INPUT AS #1
You can use other file access methods to create a new file (BINARY, RANDOM)
I don't think INPUT will work creating a new file:
INPUT: Open file for reading if it exists
OUTPUT: Open new file for output, delete and create new if exists
RANDOM: Open file for input/output, if not exists create null file
BINARY: Open file for input/output, if not exists create null file
When using INPUT and trying to open a non-existing file, you'll get a file not found error.