Home > Software engineering >  Beg to TXT read text segmentation, segmentation output source code
Beg to TXT read text segmentation, segmentation output source code

Time:10-23

The Open V For Binary As # 1
M=Space (LOF) (1)
Get # 1 and M
Close # 1

M=Replace (M, vbCrLf, vbLf) 'will be replaced by a newline carriage return + a newline, to prevent wrong operation
M=Replace (M, vbCr vbLf) 'will return characters replaced by a newline
M=Replace (M, vbLf, vbCrLf) 'will be replaced a newline carriage return + newline

Kill V
The Open V For Binary As # 1
Put # 1,, M
Close # 1

This code when TXT text than 50 M M=Space (LOF) (1)
Code string overflow, have superior explanation of text segmentation processing, I have never done it before, consult down this code to output TXT text block read what would need to change

CodePudding user response:

 
Dim n As Long, M As string, TMP As string

The Open V For Binary As # 1
The Open U For the Output As # 2
N=LOF (1)

The Do While n
If n & gt; Then 1024
M=Space (1024)
N=n - 1024
The Else
M=Space (n)
N=0
End the If

Get # 1 and M

M=TMP & amp; M
If Not EOF (1) And Right (M, 1)=vbCr Then
TMP=vbCR
M=Left (M, Len (M) - 1)
The Else
TMP=""
End the If

M=Replace (M, vbCrLf, vbLf) 'will be replaced by a newline carriage return + a newline, to prevent wrong operation
M=Replace (M, vbCr vbLf) 'will return characters replaced by a newline
M=Replace (M, vbLf, vbCrLf) 'will be replaced a newline carriage return + newline

Print # 2, M
Loop
Close # 2
Close # 1
Kill V
Rename the U, V

CodePudding user response:

Thank you for your code, and output text to read text, but after block read, cause the last line of each paragraph text file string from a line into two lines, make the next string handling from otherwise normal operations,
The output

/p>

The original should be & lt; P name="AdjsCI & gt;" 12133 & lt;/p>
What method?

CodePudding user response:

The solution is, behind the Print # 2, M there, add a semicolon, M behind
  • Related