I am having a small problem with files opened for Binary or for Random, that I believe the code below is showing me that if the file does not exist, then it creates the file (like Append would), and because I do not write anything to the file, I now have a file in my directory with 0 Kb.
(thats if I understand it correctly, but found nothing in the help files to verify this).
My problem is, that I open a file from a subdirectory, and read the information, and then close the file. But now I have a new 0Kb file in my main directory.
Is there a way around this? or do I have to go back to Open FileName for Input? so that a "Blank Copy of the File" is not created?
I would like to use Binary, because if I use "For Input" the help file says
This should be a simple fix, or if I have to kill the 0Kb file as a work around I could do that too. But hoping someone has a better idea?
(thats if I understand it correctly, but found nothing in the help files to verify this).
My problem is, that I open a file from a subdirectory, and read the information, and then close the file. But now I have a new 0Kb file in my main directory.
Is there a way around this? or do I have to go back to Open FileName for Input? so that a "Blank Copy of the File" is not created?
I would like to use Binary, because if I use "For Input" the help file says
UDT variables may not be used
Code:
#COMPILE EXE #DIM ALL FUNCTION PBMAIN () AS LONG LOCAL FileName AS STRING LOCAL Index AS LONG LOCAL FileNo AS LONG LOCAL sFileBuffer AS STRING FileNo = FREEFILE 'Open database FileName = "03f0 Hewlett Packard.db" ' OPEN FileName FOR BINARY AS FileNo 'Get database into string OPEN FileName FOR RANDOM AS FileNo 'Get database into string GET$ FileNo, LOF(FileNo), sFileBuffer 'Close database CLOSE FileNo END FUNCTION
Comment