Page 1 of 1

End ofFile Character

Posted: Tue Aug 31, 2010 11:39 am
by omni
Roger,

We are sending a file to a web page that cannot have the end of file character (hex 1A).

We are using fwrite() and fclose(). Is there a way (method) to save this file without that character in Alaska, or any method to strip it off?

Fred Henck
Omni

Re: End ofFile Character

Posted: Tue Aug 31, 2010 11:45 am
by Cliff Wiernik
I will have to check but I thought that memowrit() did this but the fxxxxx functions did not. Had came across this with the xml functions in express++.

Not completely certain without some testing.

Cliff.

Re: End ofFile Character

Posted: Tue Aug 31, 2010 12:11 pm
by omni
Oh, I thought it was the other way around. Let me try the memowrite. I think I remember that also.

Thanks, Cliff

Fred

Re: End ofFile Character

Posted: Tue Aug 31, 2010 12:33 pm
by skiman
Hi,

'memowrit' will add that character. Normally you wont have it when you use fwrite.

This is my function which i use for years.

Code: Select all


function abomemowrite(cTargetFile,cBuffer)
******************************************
Local nTarget := FCreate( cTargetFile, FC_NORMAL )
if nTarget == -1
    return .F.
  else
    FWrite( nTarget, cBuffer)
    FClose(ntarget)
endif 
return .T.

Re: End ofFile Character

Posted: Tue Aug 31, 2010 3:40 pm
by rdonnay
FWrite() does not add an EOF character.

I suspect that the EOF character is in the buffer text that you are writing.

Re: End ofFile Character

Posted: Wed Sep 01, 2010 1:13 pm
by omni
Verified and memowrit, which is used for our log routine and other situations, just updates info in a file, and never has an eof character, at least not the way we do it.

We do a memoread, then write the memoread plus what is to be added. On our error logs, it never ends I think we got this straight from Rogers error routine years ago.

Fred

Re: End ofFile Character

Posted: Tue Sep 07, 2010 8:26 am
by omni
Sorry, I was wrong. The fwrite is the one that does not have the eof character.

Re: End ofFile Character

Posted: Tue Sep 07, 2010 8:34 am
by skiman
Hi,

That was what I thought.
It's the reason I made my abomemowrit() function once.