File Create Error
BlitzMax Forums/BlitzMax Programming/File Create Error
| ||
I am unable to create a file as follows:Local levname$ Input levname$ Local filenametrimmed$ = Left(levname$,Len(levname$)-1) Local success=CreateFile(filenametrimmed$) If Not success RuntimeError "error creating file" But the following code works:
success=CreateFile("myfile")
If Not success RuntimeError "error creating file"
Any ideas? My code does not work whether or not it strips the carriage return. |
| ||
The Input command returns the value that you have typed at the prompt so you need a variable to put the result into...
Local levname$
levname = Input("Input filename: ")
Local filenametrimmed$ = Left(levname$,Len(levname$)-1)
Local success=CreateFile(filenametrimmed$)
If Not success RuntimeError "error creating file"
BTW theres no need to remove any extra 'unprintable' characters as this is taken care of already, so you example will actually remove a character from the end the inputted string. Hope it helps. |
| ||
| That worked, thanks. |