delorie.com/archives/browse.cgi | search |
From: | xholp09 AT drson DOT vse DOT cz (Pavel Holejsovsky) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: what about the "\" |
Date: | 12 Dec 1996 12:53:23 GMT |
Organization: | VSE na Zizkove |
Lines: | 16 |
Message-ID: | <58ov83$h6l@vse470.vse.cz> |
References: | <9612111400 DOT AA05959 AT emma DOT ruc DOT dk> |
NNTP-Posting-Host: | drson.vse.cz |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
: 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? correct is strcpy( str, "C:\\PT" ); because "\" character in string means begin-escape-char and it allows you putting chars like newline ("\n") and tab ("\t") into string. If you want backslash itself, you have to use "\\". bye Pavel
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |