Home > Archive > Clipper > March 2004 > copy toend of file marker
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
copy toend of file marker
|
|
| Andreas Moroder 2004-03-26, 10:57 pm |
| Hello,
when exporting data with copy to the file gets a hex 1a byte appended.
Is it possible to create a sdf file without his byte added ?
Thanks
Andreas
| |
| Stephen Quinn 2004-03-26, 10:57 pm |
| Andreas
> when exporting data with copy to the file gets a hex 1a byte appended.
> Is it possible to create a sdf file without his byte added ?
After creating the file, open it, move to the end byte - 1, write a byte, close the file.
Eg
nHandle := FOpen( 'sdffile.txt', FO_READWRITE + FO_EXCLUSIVE )
FS ( nHandle, -1, FS_END )
FWrite( nHandle, CHR(32), 1 )
FClose( nHandle )
--
HTH
Steve Quinn
| |
| Andreas Moroder 2004-03-26, 10:57 pm |
| Stephen Quinn schrieb:
> Andreas
>
>
>
>
> After creating the file, open it, move to the end byte - 1, write a byte, close the file.
> Eg
> nHandle := FOpen( 'sdffile.txt', FO_READWRITE + FO_EXCLUSIVE )
> FS ( nHandle, -1, FS_END )
> FWrite( nHandle, CHR(32), 1 )
> FClose( nHandle )
>
> --
> HTH
> Steve Quinn
>
>
hello Steve,
this does not truncate the file, but in our case it seems it works.
Thanks
Andreas
| |
| Joe Wright 2004-03-26, 10:58 pm |
| Andreas Moroder wrote:
> Hello,
>
> when exporting data with copy to the file gets a hex 1a byte appended.
>
> Is it possible to create a sdf file without his byte added ?
>
Why is it a problem? The 0x1a is chr(26) otherwise Cntrl-Z, the old CP/M
and MSDOS end-of-file indicator. It is invisible in normal contexts. Why
do you want to 'get rid' of it? If you concatenate two sdf files, the ^Z
at the end of the first one disappears and is replaced by the first byte
of the second file.
You may very well have a problem. I'm just curious what it is.
--
Joe Wright mailto:joewwright@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
| |
| Stephen Quinn 2004-03-26, 10:58 pm |
| Andreas
> this does not truncate the file, but in our case it seems it works.
Well it's to overwrite the CHR(26) (Ctrl+Z/EOF) with CHR(32) (SPACE)
If you want to truncate it then you'll need to copy the file all bar the last character.
If you have Funck(y), it has a Truncate() function.
--
HTH
Steve Quinn
| |
| pete@nospam.demon.co.uk 2004-03-26, 10:58 pm |
| In article <c2s4j7$ift$1@news.flashnet.it>
amoroder@sb-brixen[nospam].it "Andreas Moroder" writes:
> Stephen Quinn schrieb:
>
> close the file.
> hello Steve,
>
> this does not truncate the file, but in our case it seems it works.
In order to truncate the file you must write zero bytes to it --
just change
[color=darkred]
to:
FWrite( nHandle, "" )
and that ^Z will disappear...
Pete
--
"We have not inherited the earth from our ancestors,
we have borrowed it from our descendants."
| |
| Andreas Moroder 2004-03-26, 10:58 pm |
| Joe Wright schrieb:
> Andreas Moroder wrote:
>
> Why is it a problem? The 0x1a is chr(26) otherwise Cntrl-Z, the old CP/M
> and MSDOS end-of-file indicator. It is invisible in normal contexts. Why
> do you want to 'get rid' of it? If you concatenate two sdf files, the ^Z
> at the end of the first one disappears and is replaced by the first byte
> of the second file.
>
> You may very well have a problem. I'm just curious what it is.
Because the web application i load the data into does not like this char.
Bye
Andreas
| |
| Dave Pearson 2004-03-26, 10:58 pm |
| * Stephen Quinn <steveqNOSPAM@integritynet.com.au>:
> If you want to truncate it then you'll need to copy the file all bar the
> last character. If you have Funck(y), it has a Truncate() function.
Or you can FSEEK() to the location you want to truncate from and then do a:
,----
| fwrite( hFile, "", 0 )
`----
--
Dave Pearson | OSLib - Timeslice release functions.
http://www.davep.org/ | eg - Norton Guide reader for Linux.
http://www.davep.org/clipper/ | weg - Norton Guide reader for Windows.
http://www.davep.org/norton-guides/ | dgscan - DGROUP scanner for Clipper.
|
|
|
|
|