SCOUG-HELP Mailing List Archives
Return to [ 04 |
November |
2004 ]
>> Next Message >>
Content Type: text/plain
=====================================================
If you are responding to someone asking for help who
may not be a member of this list, be sure to use the
REPLY TO ALL feature of your email program.
=====================================================
I am trying to copy lines from file #1 to file #2, completely
overwriting ALL the data on file #1.
File #2 is ALWAYS smaller than file #1
I do not want to simply delete file #1 and recreate it.
I am trying to use the code...
j=0
DO UNTIL j = TheEnd /* TheEnd is line number of file #1
EOF */
line = LineIn('tmp.msg') /* tmp.msg = file #2 */
call lineout msgfile, line /* msgfile = file #1 */
j = j+1
END
This fails to do the job. It writes the smaller file but leaves
the excess data at the end and filling the lines below the end of
the newly written data with blanks (as desired) but having the
effect of moving down the lines it is overwriting. I am guessing it
has to do with not changing the file size because the file size
does not change.
What I'm trying to say is
File #1 has text
abc
def
ghi
File #2 has text
xyz
123
What I end up with is this with a file size the same as File #1.
xyz
123
ghi
How can I overwrite a file with data from a smaller file and wipe
out the old stuff without deleting the original file first?
Thanks, Jon
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-help".
For problems, contact the list owner at
"rollin@scoug.com".
=====================================================
>> Next Message >>
Return to [ 04 |
November |
2004 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|