05-21-2003, 09:59 PM
I have a prime number finder and I am trying to get it to save every number found to a file. Can someone tell exactally how to do this. I don't need a button, I just want it to save sutomatically so I can open teh .dat file with another program.
05-21-2003, 10:08 PM
You use the Open statement to open the file for Output. It is created for you if it doesn't already exist. Open for Append if you don't want to erase what is already in the file. Search the forum for examples. Or check MSDN. There's plenty of examples already written. Specifically look in the Tutors Corner I think (might be the Code Library) for a tutorial by orufet on the Open statement. I remember the title of the thread being "Open".
05-21-2003, 10:47 PM
it says "object needed" when I do the following:
r = freefile
(it says need object right here) Open prime.doc For Append As #r
05-22-2003, 12:29 PM
The filename needs to be inside quotes. " and ". Also, i think you need the full path with the filename.
05-22-2003, 01:27 PM
Also, i think you need the full path with the filename.While the full pathname isn't required, the file will be saved relative in the current folder, which may not be what you expected. It's generally a good idea to specify the full path.
05-22-2003, 04:17 PM
Yeah, when I said that, I wasn't sure if you needed the full path for saving in the current directy. Obviously it would be needed to save anywhere else.