delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/11/15:00:44.3

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: string class help
Date: Sun, 11 Jun 2000 19:09:57 +0100
Organization: Customer of Planet Online
Lines: 25
Message-ID: <ejk7ks0gsef9koalf8ol90licaa63jg0pq@4ax.com>
References: <8i0bah$858$1 AT violet DOT singnet DOT com DOT sg>
NNTP-Posting-Host: modem-123.einsteinium.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg4.svr.pol.co.uk 960746980 4397 62.136.69.123 (11 Jun 2000 18:09:40 GMT)
NNTP-Posting-Date: 11 Jun 2000 18:09:40 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Low Yew Sing" <slasher AT singnet DOT com DOT sg> wrote:

> Hi ,
>     can anyone give an eg of how to use the string class provided by DJGPP.
> i have written a small section of code using the string class provided.
> However, the complier does not recognise the string initialisation.
> e.g  string example;    // no recognition given for this declaration

// strhello.cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s = "Hello";
    s += ' ';
    s += "World!";
    cout << s << endl;
}

Compile with something like:  gpp -Wall strhello.cpp -o strhello

BTW, The string class is not specific to DJGPP so any good C++ book
should explain it and provide examples of its usage.  You could
probably find more examples posted in a C++ language group.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019