On Fri, Oct 23, 2009 at 4:48 PM, totallyfreeenergy
<[email protected]> wrote:
>> What are you having trouble with for the string concatenation? Use
>> strcat() for C-style strings and use +-operator for C++ std::string.
> I mean the example link you had given didn't work.  It may be because I
> am doing it inside a function and not the main.

Here's a simpler one then:

#include <iostream>
#include <string>

using namespace std;

int main() {

  string hello = "Hello";
  string world = "world";
  string final = hello + " " + world;

  cout << final << endl;
}

$ g++ -o test cppstring.cpp

$ ./test
Hello world

>> There are no ltrim or rtrim functions in C or C++, you will have to
>> roll your own or find a 3rd party library like Boost to get the
>> algorithm. A quick Google search should yield examples on how to write
>> your own ltrim or rtrim function.
> I thought I didn't have to re-invent the wheel.  This right trim is a
> basic functionality it should be there already.

Apparently the C standards committee doesn't agree with you here :-)

>> How are you converting the string to integer?
> I am using something like atoi

How about showing some of your code?

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to