LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting a string over several lines in a c file

Hello,
 
I know this is more a question about the c language and not really a CVI issue, but I hope someone can help me out here.
I wonder if it is possible to split a string over several lines in a c file. I'll give an example:
 
Suppose I have the very large string that I am using in a Formatting function:
Fmt (string, "Hello all. This is a very large string, containing %i characters which I would like to split over %i lines.", num_chars, num_lines);
 
Now, I would like to split this code into two lines. Is there any character I can use to split this string, e.g.
Fmt (string, "Hello all. This is a very large string, containing %i characters \ 
which I would like to split over %i lines.", num_chars, num_lines);
where the \-character would be the character to split the string (like you can use in a macro).
 
Thanks for all help,
Wim
0 Kudos
Message 1 of 3
(3,866 Views)
You can split it like this:
 
Fmt (string, "Hello all. This is a very large string,"
    " containing %i characters which I would like"
    " to split over %i lines.", num_chars, num_lines);
 
The compiler will concatenate contiguous literal strings, that are separated only by white space.
 
JR
Message 2 of 3
(3,865 Views)
Thanks a lot JR Smiley Very Happy
0 Kudos
Message 3 of 3
(3,860 Views)