|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Display quotes
Hello, Please how can display quotes with a C program: Code:
fprintf(f," Hello "World""); in the file i'd like to have Hello "World" Thank you so much. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
When the compiler sees this, it sees " Hello "World"" as three things - a string " Hello ", the token World and an empty string, "". To get it to recognise the middle quotes as part of the string, as opposed to the end/start of the string, you need to escape them with the \ character (just like you use \n and the compiler recognizes you mean a newline, not the letter 'n'): Code:
fprintf(f," Hello \"World\""); |
| The Following User Says Thank You to JohnGraham For This Useful Post: | ||
chercheur857 (10-07-2012) | ||
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remove double quotes within double quotes - delimiter used is comma | makn | Shell Programming and Scripting | 5 | 05-15-2012 04:54 AM |
| Having a terrible problem with quotes/single quotes! | jondecker76 | Shell Programming and Scripting | 2 | 07-27-2011 04:22 AM |
| grep single quotes or double quotes | george_vandelet | UNIX for Dummies Questions & Answers | 2 | 10-27-2010 11:23 AM |
| Single quotes and double quotes | sol_nov | Shell Programming and Scripting | 5 | 09-16-2009 09:44 PM |
| Double quotes or single quotes when using ssh? | password636 | Shell Programming and Scripting | 3 | 05-29-2008 08:52 PM |
|
|