Re: [Dev-C++] What lib should i be using instead?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: jansb000 <jan...@wx...> - 2001-07-28 16:31:48
|
I am not all to familiar with the string class that you are using, but
"filename += number" may not do what you think.
try this instead:
//
string filename = "help";
int number = 0;
filename += itoa(number); // convert int to char before appending it to
string.
cout << "{" << filename << "}" << endl;
//
You will now see that a space is added between filename and number. This
character position is to represent a minus sign if number is negative. Your
string class will probably have a function to get rid of this character.
----- Original Message -----
From: "Brian Puz" <BP...@go...>
To: <Dev...@li...>
Sent: Saturday, July 28, 2001 12:30 AM
Subject: [Dev-C++] What lib should i be using instead?
> I am using G++/string and fstream.h and am unable to open a file using a
string. I want to dianamically create file names and would prefer to do this
without char[].
>
> int number;
> string filename = "help";
> ofstream data;
>
> filename += number;
> data.open(filename);
>
>
>
> ___________________________________________________
> GO.com Mail
> Get Your Free, Private E-mail at http://mail.go.com
>
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|