| www.delorie.com/archives/browse.cgi | search |
| From: | Martin Ambuhl <mambuhl AT earthlink DOT net> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Problem using ANSI string |
| Date: | Mon, 25 Jan 1999 04:53:05 -0500 |
| References: | <36ac25e1 DOT 0 AT nsuxnews> |
| X-Posted-Path-Was: | not-for-mail |
| X-Accept-Language: | en |
| X-ELN-Date: | 25 Jan 1999 09:53:04 GMT |
| X-ELN-Insert-Date: | Mon Jan 25 01:55:07 1999 |
| Organization: | Nocturnal Aviation |
| Lines: | 25 |
| Mime-Version: | 1.0 |
| NNTP-Posting-Host: | 1cust143.tnt9.nyc3.da.uu.net |
| Message-ID: | <36AC3F01.B000C91A@earthlink.net> |
| X-Mailer: | Mozilla 4.5 [en] (Win95; I) |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"Y.K. Goh" wrote:
>
> I've some problem using the standard ANSI string class. The
> following piece of code just wouldn't compile.
> ----------------------------------------------------------------
> #include <string.h>
> #include <iostream.h>
>
> main()
> {
> string str = "Hello World";
> cout << str << endl;
> return 0;
> }
You are not, in fact, using the standard ANSI string class.
<string.h> is the header for the C string functionality. In C++ is is
spelled <cstring>.
The header for the C++ string class is <string>. To be consistent, you
should also use the current standard name of <iostream>.
--
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |