Get File Name

Blitz3D Forums/Blitz3D Beginners Area/Get File Name

asdfasdf(Posted 2004) [#1]
I thought there was a function in B3D that would return the name of a file in memory.
e.g. (In this example FileName() is the function I am talking about.)
file = WriteFile("File.txt")

realfile = FileName(file)



jfk EO-11110(Posted 2004) [#2]
There are no "files in memory". There is only data in memory, loaded from some files. It would make sense if the data was handled as a file object in memory. But it isn't. There is one exception: textures. you can determine the names of textures a brush is using (see SaveB3D in the code archives).

Other than that you always know the filename since it was you who defined it before you called any loading command.


Grisu(Posted 2004) [#3]
You can also store your data within types/dims and add an extra filename string, so you can use it later when needed.


Graythe(Posted 2004) [#4]
So no - it aint there. Good idea tho.

It's considered good practice to write a file handling function rather than code each time for each and every operation. The function could also store filenames accessed in an string array (or simple string var using a seperator to delimit each item).

As jfk indicates - we have to know the name of a file whenever we open it so plopping it into a string variable or bank or whatever shouldn't pose a problem.

FileName$="File.txt"
file = WriteFile(FileName)