Home > database >  High score high marks... Questions about pb9 read unicode file, read the blob length of 1687, a tran
High score high marks... Questions about pb9 read unicode file, read the blob length of 1687, a tran

Time:09-30

As title, below is the program
Li_FileNum=FileOpen (ddlb_1. Text, streamMode!)
FileSeek (li_FileNum, 2)
IF flen & gt; THEN 32765
IF the Mod (flen, 32765)=0 THEN
Loops=flen/32765
The ELSE
Loops=(flen/32765) + 1
END the IF
The ELSE
Loops=1
END the IF

New_pos=1
FOR I=1 to loops
Bytes_read=FileRead (li_FileNum, b)
Tot_b=tot_b + b
NEXT
//ls_text=Space (8192)
Ls_text=FromUnicode (tot_b)
//ls_text=string (tot_b)

Messagebox (string (len (tot_b)), ls_text)///this tip is 1687, the result of the content is only the first five characters
Mle_1. Text=ls_text
FileClose (li_FileNum)

CodePudding user response:

Attention, the UP

CodePudding user response:

First of all make sure that the file is not UNICODE, there will be a problem if not operation,
Second see if there are any special character interferes with the display,
I measured the UNICODE - 2554 length is normal,

CodePudding user response:

FileSeek (li_FileNum, 2)
This why?

File tablet/application ultraedit open normally?

Feel program although very poor but the problem is not big,
Look at the file upload,

CodePudding user response:

Pb help said read unicode file to jump in the two characters, or read only one?

File in notepad showed normal
In the application ultraedit open as follows:
00 00 00 FF FE 31 09 31 09 00 00 00 09 00 00 00; ? . 1...
09 00 00 00 00 00 00 09 09 00 00 00 00 31 31 31; . 1.1.1.

I don't play down, see more, but only one copy out paste? Number, can only play.

CodePudding user response:

Jump over two characters are said to be FileSeek (li_FileNum, 3)...

CodePudding user response:

Just test FileSeek (li_FileNum, 3), the results than FileSeek (li_FileNum, 2) worse, before can only read a few characters, and can't display properly, all show "?"

CodePudding user response:

31 00 00 00 00 09 31 09
These are no problem, 00 00 have a problem, how do you generated this file?

CodePudding user response:

File should be no problem, Windows notepad can correctly display the content

File is the machine's serial port to send a string, not enter

Notepad shows the following
1 20 081104 A s. LE HUMAN 0 0 F the 2008-11-07 11:20:31 AMIKAC & gt; 32 NOINTP AMPICI & gt; 16 RESIST AZTREO & gt; 16 NOINTP CEFAZO & gt; 16 NOINTP CEFEPI & gt; 16 NOINTP CEFOPE & gt; 32 NOINTP CEFOXI & gt; 16 NOINTP CEFTAZ & gt; 16 NOINTP CEFTRI & gt; 32 NOINTP CHLORA & gt; 16 NOINTP GENTAM & gt; 8 NOINTP IMIPEN & gt; 8 NOINTP LEVOFL & gt; 4 RESIST NITRO & gt; 64 NOINTP NORFLO & gt; 8 NOINTP PIPERA & gt; 64 NOINTP PIRLIM & gt; 20 SUSC TETRA & gt; 8 NOINTP TICARC & gt; 64 NOINTP TICCLA & gt; 64 NOINTP TOBRAM & gt; 8 NOINTP TRISUL & gt; 2 RESIST

CodePudding user response:

That's because the notepad to do some special processing, is the most simple validation method you use notepad to open the
What all don't move immediately save as unicode, you will find that is not the same as the original and save (see) with application ultraedit

CodePudding user response:

It is very important to verify that the file is not UNICODE, send the file as an attachment to CSDN download channel, and then stick the address to come over, we measure will know how to return a responsibility,

CodePudding user response:

According to the method of AFIC validation, what all don't move immediately save as unicode, so he found is not the same as the original and save (see) with application ultraedit

I uploaded the resources that I uploaded successfully, then how to also can not find, show my resource is empty

CodePudding user response:

The file sent.

CodePudding user response:

File read tot_b, use the following code should ls_result eventually make what you want (if you don't have a continuous 00 and Chinese words)

Long ll_lastpos=1

Blob {2} lbob_dummy
String ls_result
Long I, ll_length

Ll_length=len (tot_b)
For I=1 to ll_length
If blobmid (tot_b, I, 2)=lbob_dummy then
Ls_result +=FromUnicode (blobmid (tot_b ll_lastpos, I - ll_lastpos + 1))
I +=2
End the if
next

CodePudding user response:

http://download.csdn.net/source/1076555
This is my uploaded files, everybody come and help

CodePudding user response:

Less to write a line above, you use the

The integer li_FileNum

Blob tot_b

Li_FileNum=FileOpen (" 1. TXT ", StreamMode!)
Fileread (li_FileNum tot_b)
Fileclose (li_FileNum)

Long ll_lastpos=1

Blob {2} lbob_dummy
String ls_result
Long I, ll_length

Ll_length=len (tot_b)
For I=1 to ll_length
If blobmid (tot_b, I, 2)=lbob_dummy then
Ls_result +=FromUnicode (blobmid (tot_b ll_lastpos, I - ll_lastpos + 1))
I +=2
Ll_lastpos=I + 1
End the if
Next

Messagebox (' ', ls_result)
  • Related