Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

copy toend of file marker
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

Report this thread to moderator Post Follow-up to this message
Old Post
Andreas Moroder
03-27-04 03:57 AM


Re: copy toend of file marker
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, cl
ose 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



Report this thread to moderator Post Follow-up to this message
Old Post
Stephen Quinn
03-27-04 03:57 AM


Re: copy toend of file marker
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

Report this thread to moderator Post Follow-up to this message
Old Post
Andreas Moroder
03-27-04 03:57 AM


Re: copy toend of file marker
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 ---

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Wright
03-27-04 03:58 AM


Re: copy toend of file marker
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 las
t character.
If you have Funck(y), it has a Truncate() function.

--
HTH
Steve Quinn



Report this thread to moderator Post Follow-up to this message
Old Post
Stephen Quinn
03-27-04 03:58 AM


Re: copy toend of file marker
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
 

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."

Report this thread to moderator Post Follow-up to this message
Old Post
pete@nospam.demon.co.uk
03-27-04 03:58 AM


Re: copy toend of file marker
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

Report this thread to moderator Post Follow-up to this message
Old Post
Andreas Moroder
03-27-04 03:58 AM


Re: copy toend of file marker
* 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 Windo
ws.
http://www.davep.org/norton-guides/ | dgscan - DGROUP scanner for Clipper.

Report this thread to moderator Post Follow-up to this message
Old Post
Dave Pearson
03-27-04 03:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Clipper archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:44 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.