-
July 23rd, 2014, 04:45 AM
#1
-
July 23rd, 2014, 09:06 AM
#2
Re: How can read a line of unicode text file? and how write to a line of unicode text
guys i really need your help...
-
July 23rd, 2014, 10:38 AM
#3
Re: How can read a line of unicode text file? and how write to a line of unicode text
Read file in a buffer, then insert the needed text after the first end-of-line (as a second line)
Victor Nijegorodov
-
July 23rd, 2014, 01:52 PM
#4
Re: How can read a line of unicode text file? and how write to a line of unicode text
Originally Posted by VictorN
Read file in a buffer, then insert the needed text after the first end-of-line (as a second line)
Thanks VictorN
i test all way but i cant do that!
Possible give me sample code?
this is my test file: test.zip
thanks
Last edited by r2du-soft; July 23rd, 2014 at 02:15 PM.
-
July 23rd, 2014, 05:35 PM
#5
Re: How can read a line of unicode text file? and how write to a line of unicode text
How about Skin-A-Cat?
Code:
Option Explicit
Private Sub Form_Load()
Dim x As Integer, st As String, y As Integer
Dim ff As Integer
Dim strBuff As String
Dim str() As String
ff = FreeFile
On Error GoTo trapit
Open App.Path & "\to do3.txt" For Input As #ff
strBuff = Input(LOF(ff), ff)
Close #ff
' ----------------- two ways to skin a cat --------------
MsgBox "Lines = " & Len(strBuff) - Len(Replace(strBuff, vbCrLf, "x")) + 1
' -------------------------------------------------------
str() = Split(strBuff, vbCrLf)
MsgBox "There are " & UBound(str) + 1 & " lines in the file"
Dim words() As String
For x = 0 To UBound(str)
words = Split(str(x)) ' Split into WORDS
For y = 0 To UBound(words)
st = st & str(x) & vbCrLf & vbCrLf ' one line for each word
Next y
Next x
MsgBox st
Exit Sub
trapit:
If Err.Number = 53 Then
MsgBox ("Didn't work")
End If
End Sub
Last edited by dglienna; July 23rd, 2014 at 05:36 PM.
Reason: Posted over 8,000 times!
-
July 24th, 2014, 01:14 AM
#6
Re: How can read a line of unicode text file? and how write to a line of unicode text
Originally Posted by dglienna
How about Skin-A-Cat?
Code:
Option Explicit
Private Sub Form_Load()
Dim x As Integer, st As String, y As Integer
Dim ff As Integer
Dim strBuff As String
Dim str() As String
ff = FreeFile
On Error GoTo trapit
Open App.Path & "\to do3.txt" For Input As #ff
strBuff = Input(LOF(ff), ff)
Close #ff
' ----------------- two ways to skin a cat --------------
MsgBox "Lines = " & Len(strBuff) - Len(Replace(strBuff, vbCrLf, "x")) + 1
' -------------------------------------------------------
str() = Split(strBuff, vbCrLf)
MsgBox "There are " & UBound(str) + 1 & " lines in the file"
Dim words() As String
For x = 0 To UBound(str)
words = Split(str(x)) ' Split into WORDS
For y = 0 To UBound(words)
st = st & str(x) & vbCrLf & vbCrLf ' one line for each word
Next y
Next x
MsgBox st
Exit Sub
trapit:
If Err.Number = 53 Then
MsgBox ("Didn't work")
End If
End Sub
thanks dglienna
but not work on the Unicode file!
I put a sample Of files in post #4
please test on that
-
July 24th, 2014, 01:29 AM
#7
Re: How can read a line of unicode text file? and how write to a line of unicode text
Originally Posted by r2du-soft
thanks dglienna
but not work on the Unicode file!
Define "not work".
Victor Nijegorodov
-
July 25th, 2014, 01:04 PM
#8
Re: How can read a line of unicode text file? and how write to a line of unicode text
You'd need to split that line on ':' and also '\'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|