Textfile format BMax vs. BBPlus

BlitzMax Forums/BlitzMax Programming/Textfile format BMax vs. BBPlus

Garfield(Posted 2007) [#1]
Does anybody know whats the are differences between a *.txt file wrote with BMAX or BBPlus?


BMAX Code:
Local Writedatei:TStream = WriteFile("outlookdatei\BW3X_MAIL.txt") 

For Local zielfeld:TZielfeld = EachIn Zielfelderlist 

   zwert = zwert + zielfeld.name + Chr$(9) 
Next 
zwert = LSet$(zwert,Len(zwert)-1) ' delete last TAB     

WriteLine Writedatei, zwert 




BBPlus Code:
zielfile = WriteFile(Dateiname_Ziel)

For Z.Ziele = Each Ziele 

zstring$ = zstring$ + Z\Zielname + Chr$(9) 
Next 
zlaenge = Len(zstring$)
zstring$ = LSet$(zstring$,zlaenge-1)

WriteLine (zielfile,zstring$)


Iīve tried it with "~t" too

the problem is, Outlook Dataimport (Windows TAB separated)
will not accept the BMAx written File
, especially the TAB Separators in the first line to get the table

In Hexeditors like HxD ore a Mac OS Hexeditor the files seems already the same


ziggy(Posted 2007) [#2]
It could be a matter of endianes. Use streams instead in BlitzMax, and set them to LATIN1. I think this is the encoding of BlitzPlus.


Garfield(Posted 2007) [#3]
What is with Savetext or Loadtetxt?

Local Indatei:String = LoadText("OutlookDatei/BW3X_MAILold.txt")

Print Left(Indatei,3)

End


why I canīt see the first bytes?


ziggy(Posted 2007) [#4]
When using SaveText it will use LATIN1 when the file doesn't include any spetial character, but when it needs to write a spetial character, it will save on Unicode.
When using LoadText, it will detect encoding by the byte-order mark. If there's no byte-order m ark, it will asume it is Latin1, otherwise it will asume the apropiate Unicode subformat.


Garfield(Posted 2007) [#5]
OK, but this exactly the file I wrote, so it is in LATIN1
am I right?
the code for outfile now:
Local Writedatei:TStream = WriteStream("outlookdatei\BW3X_MAIL.txt")


the Print Left(Indatei,3) from LoadText Command Code prints the first 3 characters of the data, not any header

the same from the "old" BBPlus File


ziggy(Posted 2007) [#6]
Of course, Latin1 files doesn't have a header, and the Unicode header is ignored by the LoadText function, so when you use LoadText, you get the text, not the header followed by the text.


Garfield(Posted 2007) [#7]
I got it :)

it seems to be a strange character in my adressdata finallist

I wrote only the first zf:finalsatz into the textfile and everything is fine.


so I think the outputfile is coded with maybe UTF-16 or so if the prog will find a special character

Now every code like WriteFile, WriteStream or SaveText works fine.

BBPlus will do this different, it took the same database and the output file is correct for outlook

So, I have to find the enemy in the approx. 2000 adress entrys