Hello,
I have the following string:
const char plaintext[] = "Fourscore and seven years ago our \
fathers brought forth upon this continent \
a new nation, conceived in liberty, and dedicated \
to the proposition that all men are created equal.";
when i step through this the variable plain text looks like this:
Fourscore and seven years ago our fathers brought forth upon
this continent
a new nation, conceived in liberty, and dedicated
to the proposition that all men are created equal.
so when i go to print it displays as it is above...not pretty!
However if i declare plaintext in this fashion:
const char plaintext[] = "Fourscore and seven years ago our fathers
brought forth upon this continent a new nation, conceived in liberty,
and dedicated to the proposition that all men are created equal.";
(in an editor it would appear on one line) there are no gaps in
plaintext.
how can i use the line break "\" for aesthetics in the editor and not
have the spaces or how do i remove the spaces.
Also i am trying to print plaintext with no more than 60 characters
per line and no word can be broken when starting a new line.
example:
on printing the word liberty if it happens to exceed 60 characters at
the "b" then the entire word needs to be printed on the next line.
hope all this is clear.
Thanks,
Lino 3 2806
lino wrote: Hello,
I have the following string:
const char plaintext[] = "Fourscore and seven years ago our \ fathers brought forth upon this continent \ a new nation, conceived in liberty, and dedicated \ to the proposition that all men are created equal.";
when i step through this the variable plain text looks like this: Fourscore and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.
so when i go to print it displays as it is above...not pretty!
However if i declare plaintext in this fashion:
const char plaintext[] = "Fourscore and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.";
(in an editor it would appear on one line) there are no gaps in plaintext.
how can i use the line break "\" for aesthetics in the editor and not have the spaces or how do i remove the spaces.
Write it like this:
const char plaintext[] =
"Fourscore and seven years ago our "
"fathers brought forth upon this continent "
"a new nation, conceived in liberty, and dedicated "
"to the proposition that all men are created equal.";
Adjacent string literals are concatenated by the compiler into a single
string with no intervening newlines.
-cd
"lino" <li********@sbcglobal-dot-net.no-spam.invalid> wrote in message news:40**********@127.0.0.1... Hello,
I have the following string:
const char plaintext[] = "Fourscore and seven years ago our \ fathers brought forth upon this continent \ a new nation, conceived in liberty, and dedicated \ to the proposition that all men are created equal.";
The modern, standard, way to make a string to span multiple lines
does NOT use backslash. Try this:
const char plaintext[] =
"Fourscore and seven years ago our "
"fathers brought forth upon this continent "
"a new nation, conceived in liberty, and dedicated "
"to the proposition that all men are created equal.";
The max. string length limit still applies however.
--
An easy and economic way to do what you want to do is as follows
#define NUMBER_LINES
char * szBuffer[NUMBER_LINES]=
"Fourscore and seven years ago our"
"fathers brought forth upon this continent"
"a new nation, conceived in liberty, and dedicated"
"to the proposition that all men are created equal.
}
// The syntax is char * Buffer={"Line_0"
"Line_1"
"Line_2"
"Line_3"}
// if the buffer is outseide a function use the pointe
// if the buffer is inside a function you don't need the pointe
/
BYTE function(void
BYTE i,limit
limit = NUMBER_LINES
i=0
do
cout << szBuffer[i]
cout << " " << endl
while (++ i < limit)
return (limit)
/
// The do{}while; inserts spaces and linefeeds after each Buffer's [Line
/
// To control the number of characters you show or print/line you coul
// use the same routine. But you would have to read from each line th
// number of characters you want to show or print into another buffe
// and then show of print this new buffer. This would call for some strin
// manipulation. Easier, would be to arrange your text from the start to
// the number of characters you want to print or show/line
James Sexto This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: hokiegal99 |
last post by:
This script works as I expect, except for the last section. I want the
last section to actually remove all spaces from the front and/or end of
filenames. For example, a file that was named " test ...
|
by: jalkadir |
last post by:
I am trying to find a way to remove the leading and tailing blanks from
a string.
What I have come up with is not doing the work as I expected; because
if the value I pass to the function is "...
|
by: gopal srinivasan |
last post by:
Hi,
I have a text like this -
"This is a message containing tabs and white spaces"
Now this text contains tabs and white spaces. I want remove the tabs
and white...
|
by: Magix |
last post by:
Hi,
Everytime I received a fix-length of string, let say 15 (the unused portion
will filled with Spaces before receive), I want to remove the Spaces from
END until I encounter a non-space char....
|
by: Mike in Paradise |
last post by:
Is there a more effcient way of removing the spaces from the names for a
Enumerated value that has several values when you split it)???
When you do a toString it puts ,<SPACE> between the entries...
|
by: starsky51 |
last post by:
I'm sure it's something i'm doing wrong, I just can't see it.
I've set up a simple page with the following code:
<html>
<head>
<title>tester</title>
<script language="javascript"...
|
by: beatTheDevil |
last post by:
Hey guys,
As the title says I'm trying to make a regular expression (regex/regexp) for use in removing the comments from code. In this case, this particular regex is meant to match /* ... */...
|
by: ramu |
last post by:
Hi,
Suppose I have a string like this:
"I have a string \"and a inner string\\\" I want to remove space in
this string but not in the inner string"
In the above string I have to remove...
|
by: code green |
last post by:
I am trying to write a simple function that will take a string containing an
address line or business name and return it nicely formatted.
By this I mean extra spaces removed and words capitalised....
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |