Hi there... i'm new, using darkbasic pro, and i'm trying to make a simple text-based program that can, as part of its function, read and write small text files. It's my first project. ^.^
Problem is, i want to have the program *create* said text files using a variable name.
Here's what i have so far on this matter:
Quote: "Input "What is the character name? ";CName$
if file exist (CName$.txt)
print "A character with that name is on file. View stats? (y/n)"
input "Choice: "; StatView$
else
print "No record exists for that character. Do you wish to add one? (y/n)"
input "Choice: "; NoRecord$
endif
if StatView$="y" then gosub ViewStats
if StatView$="n" then return
if NoRecord$="y" then gosub AddStats
if NoRecord$="n" then return
return
AddStats:
open to write 1, "CName$.txt"
write string 1, CName$
close file 1
return"
As you have probably guessed it quite happily creates a file called CName$.txt, which is not the desired result. And i'm at a loss as to what needs changing.
Any help would be appreciated.