By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,780 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,780 IT Pros & Developers. It's quick & easy.

Saving Text Without Extra Line

P: 7
When I save text to a file it always ads an extra blank line. It is a pain because I have a RC4 encrypter in the program so another line messes it up and adds strange characters. I have tried different ways of saving but they all have the same effect. Any ideas on how to save without another line?

Thank You
Nov 12 '06 #1
Share this Question
Share on Google+
5 Replies


100+
P: 1,646
When I save text to a file it always ads an extra blank line. It is a pain because I have a RC4 encrypter in the program so another line messes it up and adds strange characters. I have tried different ways of saving but they all have the same effect. Any ideas on how to save without another line?

Thank You
Hi. Do you have any code so that we can see what is happenning with your save?
Nov 12 '06 #2

Expert 5K+
P: 8,434
Hi. Do you have any code so that we can see what is happenning with your save?
Yeah, it would help if we could see what you're doing now.

However, here's a suggestion. If you are using Print # to write stuff to the file, you could try using a semicolon to leave the line-break off the last line. For example, given this setup...
Expand|Select|Wrap|Line Numbers
  1. Open "Text.txt" for output access write lock write as #1
these two blocks of code will produce the same text file, but the second will have one extra line.
Expand|Select|Wrap|Line Numbers
  1. Print #1, "This is the 1st line"
  2. Print #1, "This is the 2nd line"
  3. Print #1, "This is the 3rd line" ;
  4.  
Expand|Select|Wrap|Line Numbers
  1. Print #1, "This is the 1st line"
  2. Print #1, "This is the 2nd line"
  3. Print #1, "This is the 3rd line"
Nov 12 '06 #3

P: 7
I am using

Expand|Select|Wrap|Line Numbers
  1. Dim hFile As Long
  2.    Dim sFilename As String
  3.  
  4.    sFilename = Text2
  5.  
  6.    hFile = FreeFile
  7.    Open sFilename For Output As #hFile
  8.       Print #hFile, Text1.Text
  9.    Close #hFile
Found it on a site and changed it to Text2.
Nov 12 '06 #4

Expert 5K+
P: 8,434
I am using
Expand|Select|Wrap|Line Numbers
  1. Dim hFile As Long
  2.    Dim sFilename As String
  3.    sFilename = Text2
  4.    hFile = FreeFile
  5.    Open sFilename For Output As #hFile
  6.       Print #hFile, Text1.Text
  7.    Close #hFile
Found it on a site and changed it to Text2.
Well, that's nice and simple. If you add a semicolon onto your Print #hFile statement, that should do the trick.
Expand|Select|Wrap|Line Numbers
  1. Dim hFile As Long
  2.    Dim sFilename As String
  3.    sFilename = Text2
  4.    hFile = FreeFile
  5.    Open sFilename For Output As #hFile
  6.       Print #hFile, Text1.Text ;
  7.    Close #hFile
Nov 12 '06 #5

P: 7
Yeah! That did it.
Thank you!
Nov 12 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.