public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* AsciiPrint behavior with \n linefeed characters.
@ 2016-10-13 21:29 Tim Lewis
  2016-10-14  1:24 ` Gao, Liming
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Lewis @ 2016-10-13 21:29 UTC (permalink / raw)
  To: edk2-devel-01

In using AsciiPrint (I'm presuming the behavior is also in Print, but I haven't tested), I found an interesting behavior for linefeed characters embedded in strings that are parameters. I post it here just so people who are mystified by their output can understand it.

Consider this example:

CONST CHAR16 *XyzStr = "HI\nBYE";

AsciiPrint(XyzStr);
AsciiPrint("Offset\n%s\n", XyzStr);

Output looks like this:

HI
BYE
Offset
HI
   BYE

It turns out that \n characters in the format string are converted to \r\n, but \n characters in strings that are embedded (as in the second example) are not converted. So only the linefeed character is interpreted, leading to "BYE" being suspended one character to the right and one row lower than "HI"


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-14  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13 21:29 AsciiPrint behavior with \n linefeed characters Tim Lewis
2016-10-14  1:24 ` Gao, Liming
2016-10-14  2:05   ` Tim Lewis
2016-10-14  7:03     ` Joaquin Cono Bolillo
2016-10-14  9:31     ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox