I have tried searching the forums for an answer but i could not find what i was looking for,
I'm basically trying to Write to a text file using the Append instead of Output function so that it puts all of the text on the same line.
However after 81 characters in the text document a new line is created and the remaining string that should have been on the first line starts on a new line.
Things i have tried:
- Taking off word wrap on notepad
- Putting a ";" at the end of each line
everything works fine, except depending on the length of account(i).ip and account(i).date the string will start a new line regardless of the code.
Is this a fault of notepad? Or is it something to do with my code? If there is no solution i may have to try using a SQL server or something which is too overboard for my small project. Thanks heaps for anyone that has any ideas.
Here is my code:
Code:
Public Sub write_data()
Open App.Path & "\accounts.dat" For Append As #1
For i = 0 To totalaccounts - 1
Print #1, account(i).firstname & "¿";
Print #1, account(i).surname & "¿";
Print #1, account(i).username & "¿";
Print #1, account(i).password & "¿";
Print #1, account(i).email & "¿";
Print #1, account(i).compUser & "¿";
Print #1, account(i).compName & "¿";
Print #1, account(i).ip & "¿";
Print #1, account(i).date; vbCrLf
Next i
Close 1
End Sub
This is also the text that gets written to my output file (accounts.dat) as it appears in notepad:
as you can see the date is on a new line, but by using "Append" instead of "Output" and the ";" should keep it on the same line.. hmm