Subject Re: STUFF() returns incorrect character
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Sun, 3 Jan 2021 11:10:14 +0530
Newsgroups dbase.getting-started

Good Morning John,

> I am using low level file functions (FOPEN(), FEOF(), FREAD(), FWRITE() and FCLOSE() to parse a text file. As part of this parsing, I am using three commands to replace characters in the incoming file: mstring = <incoming string>; mpos = AT(<where character to replace is found in the incoming string>);  mstring = STUFF(mstring,mpos,1,"") to do the character replacement.
>
> If I run these three steps in the Command window, it works as expected.
>
> If I run these three steps in a program, instead of NULL, I get a comma (,).
>
> I tried "",'', and NULL CHR(0) all with the same result - a comma.
>
> dBASE 8/Windows 10 64bit

Is by any chance , the next character.
For eg you replace the 10th character and , is the 11th character.

It would help us if you paste the exact code for the replacement.
We do not need the full prg but just the portion between file open and
file close.

It would also help us to know if the source file is of unix origin or
windows origin. There are minor differences.

And if you can briefly outline the cause we may be able to suggest
workarounds.

Have you tried replacing the character with space

Regards
Akshat