runtime error#58

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 32
Reputation: MrConfused is an unknown quantity at this point 
Solved Threads: 0
MrConfused MrConfused is offline Offline
Light Poster

Re: runtime error#58

 
0
  #11
Jun 29th, 2005
Runtime error 58 occurs when you try to rename a file with a name that already exists (in the same folder), or you try to save a new file with the same name as one that already exists (in the same folder).

With MSDOS, sorry Windows you cannot insert information into a file that already exists. The way around this is to first re-name the old file (so it is still there if you need it, a temporary file so to speak) with an obscure name (I use a few relevant "ABC" characters) plus a randomly generated number) for new name of the "old" file. Then I use a string to store the new name of the file (so I can still refer to it). Then you save the new information to the old file name (now you have re-named it, it won't clash). At this point if it goes wrong you can then re-name the "backup" file and you will be where you were before. If there is no problem and the new file is saved then you just delete the temporary file. If you don't then the folder will become full of the temporary files.

This sounds confusing. I think Comatose will understand what I mean. I hope you do as well.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: runtime error#58

 
0
  #12
Jun 30th, 2005
That was a trick I used to use in Batch file fun....
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 121
Reputation: jwshepherd is an unknown quantity at this point 
Solved Threads: 5
jwshepherd's Avatar
jwshepherd jwshepherd is offline Offline
Junior Poster

Re: runtime error#58

 
0
  #13
Jun 30th, 2005
If you are just trying to create a new file and want to delete the old file. use kill before your open statement.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. kill app.path & "\file.txt"
But like mrConfused stated, i would rename the file first. You might try nameing each file with the date and time, something like this usually does not get overwritten because the file name is always different, unless someone has reset the system clock or your writing more than one file per second.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Open App.Path & "\" & Year(Date) & Month(Date) & Day(Date) & Hour(Time) & Minute(Time) & Second(Time) & ".txt" For Output As #1
.: We may acquire liberty, but it is never recovered if it is lost :.
irc://irc.rizon.net/#itf
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: runtime error#58

 
0
  #14
Jun 30th, 2005
I always find shelling to be a convient way to execute simple operations.... certainly you could always use a rename function or an API call, but it's just as easy to shell with the rename command.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1
Reputation: lynfolan14 is an unknown quantity at this point 
Solved Threads: 0
lynfolan14 lynfolan14 is offline Offline
Newbie Poster

Re: runtime error#58

 
0
  #15
Aug 15th, 2005
Runtime Error 58
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 121
Reputation: jwshepherd is an unknown quantity at this point 
Solved Threads: 5
jwshepherd's Avatar
jwshepherd jwshepherd is offline Offline
Junior Poster

Re: runtime error#58

 
0
  #16
Aug 16th, 2005
Originally Posted by lynfolan14
Runtime Error 58
Is that a question?
.: We may acquire liberty, but it is never recovered if it is lost :.
irc://irc.rizon.net/#itf
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 14900 | Replies: 15
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC