[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] renaming an input file?



I am once again writing the group on a question I already have an answer to, 
just to see if someone has a better answer.  I am writing an interface that 
reads an incoming file.  To prevent someone from running a given file more than 
once, I need to rename the incoming file after I'm done with it.  Here's how 
I've thought to do it, in pseudo-code:

Open file.txt as 10 for-reading record=2226:fixed ...
Open renamedfile.txt as 20 for-writing record=2226:fixed ...

read a line from 10
write the line to 20

do whatever else I need to with the line

loop through until I'm done with the file

Close 10
Close 20

Open file.txt as 30 for-writing record=2226:fixed ...

write one blank line to 30
Close 30

Clearly (unless my pseudo-code is unreadable), this will get the job done, but 
I just feel like it's a bit cheesy.  I'm guessing that this is a fairly common 
thing to do, and I may be simply missing something incredibly obvious.  Please 
let me know if any of you have a suggestion on a better way for me to 
accomplish this.  Thanks!

-John T.


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users