[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] renaming an input file?
What I notice immediately is that while you're creating another identical
file, you're not removing the first file, so it doesn't fill your needs...
Why not close the file, and then use an OS command through call system to
rename your file??
peace,
clark 'the dragon' willis
PSA: Salary <> Slavery. If you earn a salary, your employer is renting your
services for 40 hours a week, not purchasing your soul. Your time is the
only real finite asset that you have, and once used it can never be
recovered, so don't waste it by giving it away.
I work to live; I don't live to work.
"Time is the coin of your life. It is the only coin you have, and only you
can determine how it will be spent. Be careful lest you let other people
spend it for you."
Carl Sandburg
(1878 - 1967)
----Original Message Follows----
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