简体   繁体   中英

what is the difference between \c and \\c?

I'm using \\c to center a line for terminal report. The report looks good as requested when I see it in linux box (via putty). The intented terminal is using Win1252 (Western) character set as transalation. But their side, the lines are not aligned to the center.

Their SRS says, "\\c is used to indicate that the text following the directive up to the end of line should be centered". Is there any difference in \\\\c and \\c ?

Thank you very much for any help you provide.

如果从C源代码中编写此字符串,并且希望输出为\\c ,则必须在源代码中转义转义字符\\

printf("\\c");    // Will print \c in the output

\\c means you are escaping the "c" character, allowing you to print c \\c means you are escaping the "\\" character, which allows you to print \\c

Escaping a character means that you are making the compiler ignore the character, if it is used for any functions or is reserved within a string.

Ex:

string = "bla bla \c bla \\c"; 

printing string will turn out like this:

"bla bla c bla \c"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM