Linked Questions

-1 votes
3 answers
6k views

How to make a new line in this C printf code? [duplicate]

printf("%c Trying to forget someone you love is like trying to remember someone you never knew \n\n",3); become like in vb.net: printf("%c Trying to forget someone you love is like trying to" & ...
jeff_ang24's user avatar
-3 votes
3 answers
2k views

special characters in c string literals [duplicate]

I'm writing some C code using the MySQL api to create databases, insert, update etc. I'm having a little trouble finding the cleanest/correct way to build the queries since the MySQL syntax can be ...
nak3c's user avatar
  • 439
2 votes
3 answers
188 views

Two lines string for one pointer [duplicate]

Possible Duplicate: How to split a string literal across multiple lines in C / Objective-C? Sometime I have to write several SQL statements pointed by char variable like: const char* sql="CREATE ...
Aan's user avatar
  • 12.6k
1 vote
2 answers
257 views

How do you best format very long string constants in C? [duplicate]

I have this: char * str = "hahahahahihihihihohohohohahahahahihihihihohohohohahahahahihihihihohohohohahahahahihihihihohohohohahahahahihihihihohohohohahahahahihihihihohohoho\0"; How do I format this ...
Theo Freeman's user avatar
0 votes
2 answers
222 views

Comfortable convertation HTML to NSString [duplicate]

I would like to have long 'NSString' with this html: <html> <head> <title>Title of the document</title> </head> <body> <h1>My ...
Luda's user avatar
  • 6,940
0 votes
0 answers
97 views

How to Declare multi lined string in C [duplicate]

#include <stdio.h> #include <string.h> int main() { char string[] = "firstline of string\n" +" second line of string\n" +" third line of string\n" ...
vishnu prasanth's user avatar
-1 votes
1 answer
44 views

missing terminator " character and undeclared (first use in this function) [duplicate]

#include <stdio.h> #include <stdlib.h> int main() { printf (" _____ / \ / o o \ \ ^ / \_ ~ _/ \n"); ...
Lucas Borges's user avatar
572 votes
10 answers
524k views

How to write a multi-line string literal

Is there any way to have multi-line plain-text, constant literals in C++, à la Perl? Maybe some parsing trick with #includeing a file? I know you can do it with raw strings in C++11.
rlbond's user avatar
  • 66.7k
20 votes
5 answers
6k views

Multiple printf() calls vs one printf() call with a long string?

Let's say I have one line of printf() with a long string: printf( "line 1\n" "line 2\n" "line 3\n" "line 4\n" "line 5\n" "line 6\n" "line 7\n" "line 8\n" "line 9\n.. etc"); What are the ...
eXPerience's user avatar
15 votes
4 answers
12k views

Declare a NSString in multiple lines

Is there any way to declare a NSString in multiple lines? I want to write HTML code and store it into a NSString, and in multiple lines de code will be more readable. I want to do something like this: ...
Jimmy's user avatar
  • 883
17 votes
3 answers
25k views

Defining a string over multiple lines

Please take the following: char buffer[512]; memset(buffer, 0, sizeof(buffer)); sprintf(&buffer[0],"This Is The Longest String In the World that in text goes on and.."); printf("Buffer:%s\r\n",...
Nanomurf's user avatar
  • 749
12 votes
2 answers
13k views

How to write multiline inline assembly code in GCC C++?

This does not look too friendly: __asm("command 1" "command 2" "command 3"); Do I really have to put a doublequote around every line? Also... since multiline string literals do not work ...
johnny-john's user avatar
1 vote
3 answers
5k views

Is '\n' necessary to be given to printf() in C?

I am reading the book "The C Programming Language" by Brian Kernighan and Dennis Ritchie(2nd edition, published by PHI). In the first article 1.1 Getting started of the first chapter A Tutorial ...
user31782's user avatar
  • 7,343
0 votes
1 answer
800 views

How do I wrap up the line c++

I have a very long line: const string a_string = "a long string with \" .. with \" again ... ... "; Now this string goes really long, how do I wrap up the line in an elegant way? I tried just break ...
WhatABeautifulWorld's user avatar
3 votes
1 answer
493 views

Can you use C/C++ preprocessor tokens in multiline string literals

Extending on this question and this question , is it possible to have a multiline string literal using either the preprocessor method shown or C++ multiline string literals that contain the values of ...
Ashley Duncan's user avatar

15 30 50 per page