How can you add the "\" character in a C++ program?
Like, say you're adding a program path in a program.
like say,
How do you make it accept the backslash character as part of the string, instead of interpreting it as something like "\n"?Code:stringName = "C:\Users\Blablabla";
Results 1 to 11 of 11
Thread: So....
- 04 Jul. 2012 01:58am #1
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 602.00
So....
- 04 Jul. 2012 02:02am #2
lolol
'\\' double-backslash or use ASCII son
- 04 Jul. 2012 02:08am #3
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 179.00
- 04 Jul. 2012 02:12am #4
- 04 Jul. 2012 02:22am #5
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 443.00
What do you mean ASCII? How would you add that? o.o Because things like this don't seem to help me: Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion
- 04 Jul. 2012 02:28am #6
Use those corresponding ASCII character decimals in the table and simulate it through C++'s built-in ASCII support.
Ex. string hi = "lol\92";
Printing that variable should result in "lol\" being displayed in the console. Although '\\' is obviously more shorthanded.
- 04 Jul. 2012 02:30am #7
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 271.00
- 04 Jul. 2012 02:32am #8
Yeah, most if not all modern languages support the ASCII standard. The more precedent focus right now is including Unicode support since not too many languages support that by default.
- 04 Jul. 2012 08:41pm #9
There are some useful libraries that support UNICODE characters though, which is nice.
I use an IDE that has cross-platform support for UNICODE so I don't worry about it.
- 04 Jul. 2012 08:44pm #10
- 04 Jul. 2012 09:31pm #11
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 35.00