1. Truncating Files - Please help
- Posted by andy at anders98.freeserve.co.uk Feb 06, 2002
- 454 views
This is a multi-part message in MIME format. ------=_NextPart_000_0009_01C1AF49.39D63EA0 charset="iso-8859-1" Euphoria WIN32 Using the file open for update function. When I write to file with less data than the file held previously, the data not overwritten appears at the end of the file. I need to 'truncate' the file at the end of the new data by adding a new end of file marker. Can anyone tell me how I do this. Thanks, Matthew ------=_NextPart_000_0009_01C1AF49.39D63EA0 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=iso-8859-1" http-equiv=Content-Type> <META content="MSHTML 5.00.3314.2100" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT size=2> <DIV><FONT size=2>Euphoria WIN32</FONT></DIV> <DIV><FONT size=2>Using the file open for update function. When I write to file with less data than the file held previously, the data not overwritten appears at the end of the file. I need to 'truncate' the file at the end of the new data by adding a new end of file marker. Can anyone tell me how I do this.</FONT></DIV> <DIV><FONT size=2>Thanks, </FONT></DIV> ------=_NextPart_000_0009_01C1AF49.39D63EA0--
2. Re: Truncating Files - Please help
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 06, 2002
- 489 views
This is a multi-part message in MIME format. ------=_NextPart_000_0038_01C1AFAA.734530E0 charset="iso-8859-1" If this is strictly a TEXT file then writting a Ctrl-Z (26) as the last character may help. If that doesn't work, you will be forced to create a new file by copying just the amount you want and then deleing the old and renamng the new back to the original name. For non-text files, if you have you're own internal format, you can devise a scheme where you update a pointer to the logical end of file. If it is not you're own format then you have to do the copy-delete-rename routine. The disk file systems used is DOS, Windows and Unix do not support an END-OF-FILE marker concept. With the exception that Ctrl-Z is supposed to mark the end of a TEXT file in Microsoft (and CP/M) systems. --------- Derek ----- Original Message ----- From: andy at anders98.freeserve.co.uk To: EUforum Sent: Thursday, February 07, 2002 7:02 AM Subject: Truncating Files - Please help Euphoria WIN32 Using the file open for update function. When I write to file with less data than the file held previously, the data not overwritten appears at the end of the file. I need to 'truncate' the file at the end of the new data by adding a new end of file marker. Can anyone tell me how I do this. Thanks, Matthew ------=_NextPart_000_0038_01C1AFAA.734530E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2600.0" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>If this is strictly a TEXT file then writting a Ctrl-Z (26) as the last character may help. If that doesn't work, you will be forced to create a new file by copying just the amount you want and then deleing the old and renamng the new back to the original name. </FONT></DIV> <DIV><FONT size=2></FONT> </DIV> <DIV><FONT size=2>For non-text files, if you have you're own internal format, you can devise a scheme where you update a pointer to the logical end of file. If it is not you're own format then you have to do the copy-delete-rename routine.</FONT></DIV> <DIV><FONT size=2></FONT> </DIV> <DIV><FONT size=2>The disk file systems used is DOS, Windows and Unix do not support an END-OF-FILE marker concept. With the exception that Ctrl-Z is supposed to mark the end of a TEXT file in Microsoft (and CP/M) systems.</FONT></DIV> <DIV><FONT size=2></FONT> </DIV> <DIV><FONT size=2>---------</FONT></DIV> <DIV><FONT size=2>Derek</FONT></DIV> <BLOCKQUOTE dir=ltr style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=andy at anders98.freeserve.co.uk href="mailto:andy at anders98.freeserve.co.uk">andy at anders98.freeserve.co.uk</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=EUforum at topica.com href="mailto:EUforum at topica.com">EUforum</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, February 07, 2002 7:02 AM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Truncating Files - Please help</DIV> <DIV><BR></DIV><PRE>============ The Euphoria Mailing List ============ </PRE> <DIV><FONT size=2> <DIV><FONT size=2>Euphoria WIN32</FONT></DIV> <DIV><FONT size=2>Using the file open for update function. When I write to file with less data than the file held previously, the data not overwritten appears at the end of the file. I need to 'truncate' the file at the end of the new data by adding a new end of file marker. Can anyone tell me how I do this.</FONT></DIV> <DIV><FONT size=2>Thanks, </FONT></DIV> <DIV><FONT size=2>Matthew</FONT></DIV></FONT></DIV><PRE>==^================================================================ This email was sent to: ddparnell at bigpond.com EASY UNSUBSCRIBE click here: <A href="http://topica.com/u/?b1dd66.b2mL5y">http://topica.com/u/?b1dd66.b2mL5y</A> Or send an email to: EUforum-unsubscribe at topica.com T O P I C A -- Register now to manage your mail! <A href="http://www.topica.com/partner/tag02/register">http://www.topica.com/partner/tag02/register</A> ------=_NextPart_000_0038_01C1AFAA.734530E0--