Printing data in one single line in a txt file.

Hi fellows!

Can you help me out with this issue? What happens is that I want to print random ASCII symbols in a single line of a txt file. How can I make my program print things in a single line of a txt file? Is it something like .eof() or .eoln()?

Thanks!
just don't print a newline character, then everything should be in 1 line.
Last edited on
Well, what I need to do exactly is to print random ASCII characters in only 6 lines of a txt file... I've already figured out the ASCII part, but the thing is that I create a 6 times loop. First, it fills the first line with characters, then "endl". Then, again and again, till it reaches 6 times. But when I check the txt file, there are more than 6 lines: sometimes 9 and 10 :(

How can I make it 6 lines only?
check if the randomly generated ascii character is a newline character, if it is just generate a new character

could look something like this:

1
2
3
4
5
6
char ch;
do { 
    ch = random(); // insert your random generator here
} while(ch == '\n')

print("%c", ch);
Last edited on
Yes, you're right! I hadn't thought about it! I'll test it! Thanks bro
Topic archived. No new replies allowed.