Topic: Urgent! Help in string handling
Author: antonopn@aston.ac.uk (N ANTONOPOULOS)
Date: Wed, 27 Jul 1994 12:06:49 GMT Raw View
Hello everybody,
I am develloping a Graphical User Interface in X-Windows using C++.
I have to finish my program by the beginning of august. I have the following
problem :
If we have a float variable ie a which holds the value lets say 12.34
how can i create a char pointer which will point to the string "12.34" ?
It would be extremely important for me if i could get an answer as soon as
possible.
Thanks very much in advance.
Moto:
As computer scientist i am in total control of my experiments.
Nick Antonopoulos
e-mail: antonopn@aston.ac.uk
Author: antonopn@aston.ac.uk (N ANTONOPOULOS)
Date: Wed, 27 Jul 1994 12:13:40 GMT Raw View
Hello everybody,
I have the following problem:
I have a float variable:
float a=12.34;
and i would like to ask if it's possible to create a char pointer b
which will point to the float number as a string,in other words could i
have a pointer whichh will point to the string: "12.34"?
It's extremely important to me to get an answer as soon as possible.
thank you very much in advance
Moto:
As computer scientist i am in total control of my experiments.
Nick Antonopoulos
e-mail : antonopn@aston.ac.uk
Author: davep@pcproj.datastream.co.uk (Dave Postill)
Date: 27 Jul 1994 16:08:15 +0100 Raw View
N ANTONOPOULOS (antonopn@aston.ac.uk) wrote:
:>Hello everybody,
:> I am develloping a Graphical User Interface in X-Windows using C++.
:>I have to finish my program by the beginning of august. I have the following
:>problem :
:> If we have a float variable ie a which holds the value lets say 12.34
:>how can i create a char pointer which will point to the string "12.34" ?
:>It would be extremely important for me if i could get an answer as soon as
:>possible.
:>Thanks very much in advance.
:>Moto:
:>As computer scientist i am in total control of my experiments.
:>Nick Antonopoulos
:>e-mail: antonopn@aston.ac.uk
If you can't even manage this I don't fancy your chances of finishing by the
beginning of August - you've onlt got 4 days to go ... ;-)
Hint: sprintf()
=============================================================================
-- Dave Postill Datastream International Ltd
-- Technical Consultant Monmouth House
-- PC Projects 58-64 City Road
-- London EC1Y 2AL
-- Voice: +44 (0)71 250 3000 Ext 1602 England
-- Fax: +44 (0)71 336 1952
-- Email: davep@pcproj.datastream.co.uk
=============================================================================
Author: bernard@victor (BERNARD Sebastien [93-94])
Date: 28 Jul 1994 05:02:20 GMT Raw View
N ANTONOPOULOS (antonopn@aston.ac.uk) wrote:
: Hello everybody,
: I am develloping a Graphical User Interface in X-Windows using C++.
: I have to finish my program by the beginning of august. I have the following
: problem :
: If we have a float variable ie a which holds the value lets say 12.34
: how can i create a char pointer which will point to the string "12.34" ?
: It would be extremely important for me if i could get an answer as soon as
: possible.
Well :
#include <iostream.h>
#include <strstream.h>
main()
{
float a = 12.34;
char *toto;
ostrstream TheStr;
TheStr << a;
toto = TheStr.str();
cout << toto;
return 0;
}
That's all I have to say.
: Thanks very much in advance.
: Moto:
: As computer scientist i am in total control of my experiments.
: Nick Antonopoulos
: e-mail: antonopn@aston.ac.uk