Odd Characters

BlitzPlus Forums/BlitzPlus Beginners Area/Odd Characters

dna(Posted 2012) [#1]
Hey All.


I'm using the routine:

If FLD<5 Then I$=I$+String$(" ",15)
			WriteString (FH1, I$):WF=WF+1:FLD=FLD+1:Exit;"TEST "+String$("0",4-Len(Str$(G)))+G
			Text 50,350,I$+" "+S$:Goto SRC
	EndIf


when I write the string to the file it appends some special character at the beginning of the string that was not originally in the string.

My use of the string only appends spaces at the end of i$
It looks like some space compression code of sorts which acts like a tab for some reason.

the basic format for I$ is I$="Some Text"+STRING$(" ",15) with nothing on the left of the string at all.

What is wrong here? Where is that coming from?

Last edited 2012


Floyd(Posted 2012) [#2]
The first four bytes are the length of the string. For ordinary text, terminated by CR-LF, use the WriteLine command.

WriteString can store strings which contain special characters, such as strings with c-style null terminators. I don't think I've ever actually used WriteString, other than to test it.

The docs for WriteString and WriteLine explain things fairly well, but they should really mention each other for comparison.


dna(Posted 2012) [#3]
How does a person strip the first four bytes so that the writestring command can be used.

I using that command to format the spacing within the file that is being written.


Floyd(Posted 2012) [#4]
If you are attempting to write plain text, readable by Notepad for example, then you cannot use WriteString. The resulting file would generally be used only with a Blitz program, reading it back with ReadString.

Use WriteLine for ordinary text.


dna(Posted 2012) [#5]
I see. It's something the programming language does natively.

I'll use a different format then


Thanks Floyd

Last edited 2012