www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/14/08:45:21

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: string in djgpp
Date: Tue, 14 Nov 2000 13:33:06 GMT
Organization: always disorganized
Lines: 18
Message-ID: <3a113efc.17689030@news.freeserve.net>
References: <8ur14k$q7g$1 AT dahlia DOT singnet DOT com DOT sg>
NNTP-Posting-Host: modem-142.wisconsin.dialup.pol.co.uk
X-Trace: newsg4.svr.pol.co.uk 974208787 29101 62.137.99.142 (14 Nov 2000 13:33:07 GMT)
NNTP-Posting-Date: 14 Nov 2000 13:33:07 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Tancy wrote:

> I cant declare a string even if i included <string.h> in my code, how should
> i do?

<string.h> is for functions like strcmp() and strlen().  If you
want a string in C you just use a 0-terminated char array.
In C++ there is also a standard string class:

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s = "This is a string.";
    cout << s << '\n';
}

- Raw text -


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