Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - #pragma escseq escape sequences in literal strings control http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 #pragma ESCSEQ      Escape sequences in literal strings control
------------------------------------------------------------------------------
 Syntax
   #pragma ESCSEQ+|-

 Arguments
   + and - control if the option is on or off, respectively.

 Description
   The #pragma ESCSEQ directive controls the processing of escape
   sequences within string literals. Escape sequences are special characters
   that can not be placed in a string by other means. Escape characters
   are always prepended by a backslash (\).

   By default, the \ character is processed literally within a string.
   The #pragma ESCSEQ+ directive causes the compiler to regard the \
   character as part of an escape sequence, and generate the respective
   escape code for the character following the backslash.

 Example
   #define EXAMPLE_DIRECTIV
   #include example.hdr

   proc Test_859
   ? "c:\mine\module.prg"   // default interpretation of the backslash
   
   #pragma ESCSEQ+
   ? "hello\r\nworld"       // placing a carriage return, line feed in a string
   ? "hello\0world"         // this causes the string to be terminated
   ? "c:\\mine\\module.prg" // the backslash must be duplicated in path names
   ? "c:\mine\module.prg"   // it is common to forget it
   
   #pragma ESCSEQ-
   ? "c:\mine\module.prg"   // correct path after switching off the pragma
   ? "a line" + chr( 13 ) + chr( 10 ) + "another line"
   
   #pragma ESCSEQ+
   ? "a line\r\nanother line"
   endproc

   proc main
   Test_859()
   endproc

See Also: string

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson