What does "% lt" mean in C ++? (NOT a module, I know it does)

I once saw this line of code:

std::cout %lt;%lt; "Hello world!" %lt;%lt; std:: endl; 

And I wonder what %lt;%lt; means .

+4
source share
3 answers

You must have seen this on the Internet. Someone downloaded this line:

 std::cout << "Hello world!" << std::endl; 

What has been translated for output in html:

 std::cout &lt;&lt; "Hello world!" &lt;&lt; std::endl; 

Since, of course, &lt; is an html object for < .

Finally, somewhere, somewhere, decided to change ampersands to percent signs, perhaps as part of the url coding scheme.

+33
source

Looks like "% lt;" must be escaped for http transmission. How:

 %lt;%lt; 

should have been:

 << 
+30
source

My first thought was that you might have seen code that used C trigraphs . However, for < or > there is no trigraph.

Trigraphs C and their one-character equivalents:

 ??= # ??/ \ ??' ^ ??( [ ??) ] ??! | ??< { ??> } ??- ~ 
+1
source

All Articles