Problem with MemoWirit

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Problem with MemoWirit

#1 Post by digitsoft »

Good afternoon
Can you tell me why MemoWirit writes strange characters at the end of the last line?
Attachments
MemoWirit.jpg
MemoWirit.jpg (134.98 KiB) Viewed 1684 times
Nolberto Paulino
Regards

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Problem with MemoWirit

#2 Post by Tom »

MemoWrit() adds an EoF-character to the file contens (HEX 1A, Dec 26). Use StrFile() instead (take care - parameters are exchanged), or the low level functions.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Problem with MemoWirit

#3 Post by skiman »

Hi,

You can use this as a replacement:

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.
Best regards,

Chris.
www.aboservice.be

k-insis
Posts: 100
Joined: Fri Jan 28, 2011 4:07 am

Re: Problem with MemoWirit

#4 Post by k-insis »

This.

Also memoread/memowrit is not that good when using UTF-8 data ; it tries to do some chardata conversion on its own. Found it the hard way when using xml with international IBAN processing resoults years ago.

Using regular fileio functions is much safer choice.

skiman wrote: Mon Dec 18, 2023 1:47 am Hi,

You can use this as a replacement:

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.

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Problem with MemoWirit

#5 Post by Tom »

StrFile() does the same, without any conversions.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: Problem with MemoWirit

#6 Post by digitsoft »

Tom wrote: Sun Dec 17, 2023 11:49 pm MemoWrit() adds an EoF-character to the file contens (HEX 1A, Dec 26). Use StrFile() instead (take care - parameters are exchanged), or the low level functions.
thank you
Nolberto Paulino
Regards

Post Reply