|
From: Ioannis V. <no...@ya...> - 2001-12-08 15:13:13
|
With strcpy() defined in <cstring>, and <string.h>. But better use the
string type defined in <string>. For example:
#include <iostream>
#include <string>
int main()
{
using namespace std;
string a="This is";
string b=" a string\n";
string c;
c=a+b; // c=="This is a string\n"
a+=b; // a=="This is a string\n"
cout<<a<<c;
}
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Exuss Draugas
> Sent: Friday, December 07, 2001 7:58 PM
> To: Dev...@li...
> Subject: [Dev-C++] Array of char
>
>
>
>
> Hi All!
>
> Just a simple question. How to assing a value to array of char?
>
> char myValue[20] = "Some text!";
> cout << myValue << endl;
>
> // This is don't work :((
> myValue="New text";
>
> Works only: cin >> myValue;
>
> Thanks,
>
> Exuss
>
>
>
>
>
>
> --
> Nemokama el.pasto dezute - http://webmail.delfi.lt/
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|