Mail Archives: djgpp/1996/12/12/11:09:40
X-Files: sunday
X-Dollar-F: owner-djgpp-list AT delorie DOT com
X-Dollar-G: owner-djgpp-list AT delorie DOT com
Errors-To: postmaster AT ns1
From: owsim AT emma DOT ruc DOT dk (Ole Winther)
Date: Wed, 11 Dec 1996 15:00:40 +0100 (MET)
X-Mailer: ELM [version 2.4 PL21]
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=ISO-8859-1
Content-Length: 261
Well some small problems
I where trying this.
char* str;
str = new char[5];
strcpy( str, "C:\PT" );
and printing this gives ( C:PT ), the "\" is stripped. when compiling the
programs there complains about and unknown escape char. How to do it?
The last line should be:
strcpy( str, "C:\\PT" );
In "C" the backslash (\) character is a quote character for special notations
like '\n' for newline and '\r' for carriage return. To enter an explicit '\'
you must quote it by doubling it: '\\'.
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -