Is using \b, \r in output allowed?

Write here if you have problems with your C source code

Moderator: Board moderators

Post Reply
Oka
New poster
Posts: 2
Joined: Sat Jun 28, 2008 2:57 pm

Is using \b, \r in output allowed?

Post by Oka » Sat Jun 28, 2008 4:08 pm

I just want to know, can i use \b or \r in output with printf?
I want to use them, but i'm not sure that Judge will accept them.... Thanks. :)

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: Is using \b, \r in output allowed?

Post by Jan » Sat Jun 28, 2008 11:17 pm

Use \b or \r and then store the output in a file. Then you may see some unusual characters. So, don't use them. (I am sure about \b, not sure about \r)
Ami ekhono shopno dekhi...
HomePage

Oka
New poster
Posts: 2
Joined: Sat Jun 28, 2008 2:57 pm

Re: Is using \b, \r in output allowed?

Post by Oka » Sun Jun 29, 2008 7:49 am

Jan wrote:Use \b or \r and then store the output in a file. Then you may see some unusual characters. So, don't use them. (I am sure about \b, not sure about \r)
Okay, thanks! :D

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Re: Is using \b, \r in output allowed?

Post by mf » Sun Jun 29, 2008 7:59 pm

Why would you want to output \b and \r?
For almost all problems, the output is always an ASCII text file, and never needs such characters.
Only a couple or so problems (about encryption/compression) use binary output format, but you'd probably want to use putchar/fwrite there instead of printf.

The judge runs Linux, so it would expect LF (\n) line endings, and not Windows's CR LF (\r\n), But if you're using standard library functions like printf, you don't need to worry about it. Just use \n, and the library will automatically output the right line ending for the current OS.

Post Reply

Return to “C”