| | |
Reading .dat file
![]() |
•
•
Join Date: Sep 2006
Posts: 54
Reputation:
Solved Threads: 1
hello Guys,
can somebody help me reading a .dat file then output the file in a textfile
sample .dat file
1 2007-02-12 18:13:13 1
1 2007-02-12 18:13:20 1
1 2007-02-12 18:13:23 1
1 2007-02-12 18:14:04 1
12345 2007-02-12 18:15:15 1
1 2007-02-12 18:15:17 1
12345 2007-02-12 18:15:19 1
sample Output
the content of the text file should have this kind of format.
2007/02/12 18:13:13, Event:Access Door:1, Card No.00001
2007/02/12 18:13:20, Event:Access Door:1, Card No.00001
2007/02/12 18:13:23, Event:Access Door:1, Card No.00001
2007/02/12 18:14:04, Event:Access Door:1, Card No.00001
2007/02/12 18:15:15, Event:Access Door:1, Card No.12345
2007/02/12 18:15:17, Event:Access Door:1, Card No.00001
2007/02/12 18:15:19, Event:Access Door:1, Card No.12345
here's the sample code.
can somebody help me reading a .dat file then output the file in a textfile
sample .dat file
1 2007-02-12 18:13:13 1
1 2007-02-12 18:13:20 1
1 2007-02-12 18:13:23 1
1 2007-02-12 18:14:04 1
12345 2007-02-12 18:15:15 1
1 2007-02-12 18:15:17 1
12345 2007-02-12 18:15:19 1
sample Output
the content of the text file should have this kind of format.
2007/02/12 18:13:13, Event:Access Door:1, Card No.00001
2007/02/12 18:13:20, Event:Access Door:1, Card No.00001
2007/02/12 18:13:23, Event:Access Door:1, Card No.00001
2007/02/12 18:14:04, Event:Access Door:1, Card No.00001
2007/02/12 18:15:15, Event:Access Door:1, Card No.12345
2007/02/12 18:15:17, Event:Access Door:1, Card No.00001
2007/02/12 18:15:19, Event:Access Door:1, Card No.12345
here's the sample code.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim MyFile As String Dim FNo As Long Dim data() As String Dim fields As Integer Dim InLine As String MyFile = "C:\Textlog\1_attlog.dat" On Error Resume Next Open "C:\Andoks\" & Format(Date, "MMDDYYYY") & ".txt" For Output As #1 FNo = FreeFile If Dir(MyFile, vbDirectory) <> "" Then Open MyFile For Input As FNo While Not EOF(FNo) Line Input #FNo, InLine data() = Split(InLine) fields = UBound(data()) 'Open "C:\Andoks\" & Format(Left(data(0), 10), "MMDDYYYY") & ".txt" For Output As #1 'Back Up "" Print #1, Format(Right(data(0), 10), "YYYY/MM/DD") & " " & Left(data(1), 8) Print #1, Format(data(1), "YYYY/MM/DD") & " " & Left(data(2), 8) & "," & " " & "Event:Access," & " " & "Door:1," & " " & "Card No.:" & Format(Right(data(0), 5), "00000") Wend End If MsgBox "Attendance successfully downloaded ", vbInformation + vbOKOnly, "Record Saved" Unload Me Me.Show 'close Close #FNo Close #1 Exit Sub
![]() |
Similar Threads
- Reading .dat file data into an array (C#)
- Reading in a .dat file from SSH shell command line (Java)
- Making a .dat file (C++)
- Reading an input file as a class memeber function (C++)
- reading txt file into array (C++)
- Not reading in entire file. (C++)
- read a dat file through C (C)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Please Help me with Printing a record
- Next Thread: Please Help me with frmLogin
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






