Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File Names
#1
I am constructing a simple Accounts Program Where I save the Balance each time by useing the Code
OPEN "Total.num" FOR OUTPUT AS #1
and I retreive the Balance by opening the file
OPEN "Total.num" FOR INPUT AS #1
Now I want to improve on things by be able to choose a different file name each time
whats the answer
Reply
#2
If you're going to ask the user what filename he/she wants, it can be done easily like this:
Code:
INPUT "Filename: ";filename$ 'Get's the filename
OPEN filename$ FOR OUTPUT AS #1
If you want to tag on an automatic extenstion to the filename, you can simply:
OPEN filename$ + ".num" FOR OUTPUT AS #1
And if you want to place the file in a different place with an extension:
OPEN "C:\dir\dir2\dir3\" + filename$ + ".num" FOR OUTPUT AS #1
And, of course the directories I show and the extensions can be different from what I show.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)