Re: Print with no line feed

Tech-Archive recommends: Fix windows errors by optimizing your registry



I think it's a little harsh to scold the OP because he didn't RTFM. Here's
what my help file says:

Use a semicolon to position the insertion point immediately after the last
character displayed.

and

Multiple expressions can be separated with either a space or a semicolon. A
space has the same effect as a semicolon.

I don't think it's at all clear that the semi-colon accomplishes what the OP
asked. I recall that it took me some time to figure out how to do exactly
what the OP wanted to do. I don't know about others but I think this is
just one example of frequently obfuscated MS documentation.

Luke

"Rick Rothstein (MVP - VB)" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx> wrote in
message news:Ord55QqcIHA.1376@xxxxxxxxxxxxxxxxxxxxxxx
Did you try either of what Dave posted? If you look carefully at the
second one, you will see a semi-colon after the Print statement
argument... that tells the Print statement to suppress the line feed
(actually, it is a carriage return followed by a line feed the Print added
to your output and it is this combination that the semi-colon suppresses).
By the way, this is covered in the help files for the Print# Statement
(which I am guessing you didn't read).

Rick


<gimme_this_gimme_that@xxxxxxxxx> wrote in message
news:9c7d6ef5-a745-492e-8606-d93f10d58807@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No silly.

Is there a way to tell Print not to add the line feed?


On Feb 18, 3:31 pm, Dave Peterson <peter...@xxxxxxxxxxxxxxxx> wrote:
Sub Write2()
Open "C:\output.txt" For Output As #1
Print #1, "hello world"
Close #1
End Sub

or maybe...

Sub Write2()
Open "C:\output.txt" For Output As #1
Print #1, "hello";
Print #1, " world";
Close #1
End Sub





"gimme_this_gimme_t...@xxxxxxxxx" wrote:

I have:

Sub Write2()
Open "C:\output.txt" For Output As #1
Print #1, "hello"
Print #1, " world"
Close #1
End Sub

Which creates a file that looks like

hello
world

Is there a way to tell Print not to add the line feed - so I can get

hello world

Thanks.

--

Dave Peterson- Hide quoted text -

- Show quoted text -



.



Relevant Pages

  • Re: Simple question regarding the use of ;
    ... some variations in the way people use the semi-colon. ... compound statement is enclosed by '' and contains zero or more ... simple or compound statement; there is no need for a ';' to terminate a ... Otherwise you could say the last statement in a block doesn't need a terminating semicolon because the} does that job too. ...
    (comp.lang.c)
  • Re: passing arguments
    ... The latter, it is my understanding, is the reason he posts as Dr. John instead of just John. ... When asked to provide "typical" code where the lack of a semicolon caused an error when the semicolon removed it, I got one example and Richard couldn't remember the full context. ... there are places that adding a semi-colon to the end of a line will cause errors where the lack of that semi-colon isn't an error. ...
    (comp.lang.javascript)
  • Re: a little syntax goes a long way??
    ... > semi-colon at the end, ... > this small syntactic difference represents a larger conceptual ... When you declare a function, you use a semicolon at the end. ...
    (comp.lang.cpp)