Forums Register Login

new line character

+Pie Number of slices to send: Send
I have no problem using the println() function when needed, but cannot get the newline character \n to work. Each attempt to use it, the compiler says "invalid character". This happens no matter where I insert it, front, middle or end of a sentence. Any suggestions?
+Pie Number of slices to send: Send
is it included as a part of a string ? can you show your code ?
+Pie Number of slices to send: Send
if ( count >= 56 )
\nSystem.out.print( args.[i] ) ;
above gives invalid character.

if ( count >= 56 )
System.out.println( args.[i] ) ;
above works fine except newline comes after i is printed
+Pie Number of slices to send: Send
The line you have that doesn't work isn't printing the newline.
You need to include it in the string that is output...

or even better (since the newline character is system dependant)...

or if you're looking for a third answer:

Dave.
[This message has been edited by David O'Meara (edited May 15, 2001).]
+Pie Number of slices to send: Send
See what a difference makes posting a little code
+Pie Number of slices to send: Send
Thanks a bunch Val and David. That works great. I see what you mean about a little bit of code. It does kind of show where the error is right away.
+Pie Number of slices to send: Send
Thank You Val and David. Posting code does make a difference doesn't it?
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1645 times.
Similar Threads
Returning the last line in a file.
Problem in writing text line by line....
Question about enums and enhanced for
About Saving in a file
Beginning Programming FAQ
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:19:05.