Article View: alt.comp.lang.learn.c-c++
Article #121Re: convert *char to string
From: Bart v Ingen Schenau
Date: Fri, 14 Jan 2000 00:00
Date: Fri, 14 Jan 2000 00:00
24 lines
1711 bytes
1711 bytes
On Fri, 14 Jan 2000 07:36:26 +1000, "Jarne Cook" <jarne@powerup.com.au> wrote: >Can anyone tell me how to convert a char* to a string or get access to each >charater one by one. > >I am trying to get char* argv[1] ( the first argument) so that I can >manipulate each character. Can someone PLEEEZE tell me if there is a >standard c++ call to do that. First, argv[1] already contains a (C-style) string, as it is an array of char with a terminating '\0'. Second, the string class accepts a char* argument as initialisation, so you could write: string MyString(argv[1]); >---------------------------------------------------------------------------- >---- >Jarne Cook Public Email: jarne_cook@hotmail.com >Uni Email : j2.cook@student.qut.edu.au >ICQ # : 27100420 >---------------------------------------------------------------------------- >---- > Bart v Ingen Schenau
Technical Details
Message-ID:
<3882e9c2.6290410@news.bcandid.deja.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<387ed1c7@grissom>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4ba,9c3f098f257151c0 X-Google-Attributes: gid10d4ba,public X-Google-Thread: 114592,9c3f098f257151c0 X-Google-Attributes: gid114592,public X-Google-Thread: 109fba,9c3f098f257151c0 X-Google-Attributes: gid109fba,public From: b.vaningenschenau.NoSPAM@student.utwente.nl (Bart v Ingen Schenau) Subject: Re: convert *char to string Date: 2000/01/14 Message-ID: <3882e9c2.6290410@news.bcandid.deja.com> X-Deja-AN: 572484431 Content-Transfer-Encoding: 7bit References: <387ed1c7@grissom> Content-Type: text/plain; charset=us-ascii X-Trace: 2-001e8b75c4d735ddf6a888d14052f0cb333c8fb92e66b3b9b4bcd2112646e713b9d2 MIME-Version: 1.0 NNTP-Posting-Date: Fri, 14 Jan 2000 04:21:51 EST Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++