Okay, so to start off. I've successfully created and stored information to a file in DBPRO before. However, using the
write string command doesn't seem to be working correctly for some reason. I'm using the latest beta build of Darkbasic Pro 7.
Function Menu_Input()
`DESCRIPTION: Tells the program what to do when user clicks the menu items.
`INPUT: N/A
`RETURNS: N/A
`Define locals.
Local tileset$ as string
texFilter$ = "Archaic Map File (amp)|*.amp*"
`Save the map.
if twGetGadgetLeftClickCount(g_SaveMap) > 0
tileset$ = twSaveFileBox(g_mainToolWindow, texFilter$)
if tileset$ <> ""
`Create the file and open to write.
tileset$ = tileset$ + ".amp"
! make file tileset$
Open to write 1, tileset$
`Save Current Tileset Image.
write string 1, tileset$
endif
endif
Endfunction
This function loads a save box, then asks for a file name. It's then suppose to create a file using that file and path name. Then write a string into that file. The string fails to write though, and when I open the file it contains 0 bytes of data.
[edit]
Nvm, if I just learned to use the search tool more I would have found the answer by now. Apparently you can't make the file first, because you can't write a string to a file that already exists.
To make this thread less useless, how would I go about editing a file that already exists(seeing as you can't write to a file that exists already)?
Check out my developer forums at:
http://archaicstudios.net/forums