Hello,

In console application (Visual C++ 6.0)
How can I convert string to number ?

Thanks :)

Re: Convert string to number by John

John
Sat May 07 05:37:33 CDT 2005

...
I have tried stof function,
but compiler doesn't know this function ('atof' undeclared undetifier).

Thanks :)

"John M" <nobody@nospam_please.com> wrote in message
news:%23kEiBbuUFHA.1044@TK2MSFTNGP10.phx.gbl...
> Hello,
>
> In console application (Visual C++ 6.0)
> How can I convert string to number ?
>
> Thanks :)
>
>



Re: Convert string to number by John

John
Sat May 07 06:35:59 CDT 2005

What I did before :

#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include "stdafx.h"

and the correction :
#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include <stdio.h>
#include <conio.h>

... and things work fine.
I don't know why I need to do this (change the "stdafx.h" to its correct
place), but it took me long time to figure out this problem.

Thanks, anyway :)

"John M" <nobody@nospam_please.com> wrote in message
news:eTgnNguUFHA.2420@TK2MSFTNGP12.phx.gbl...
> ...
> I have tried stof function,
> but compiler doesn't know this function ('atof' undeclared undetifier).
>
> Thanks :)
>
> "John M" <nobody@nospam_please.com> wrote in message
> news:%23kEiBbuUFHA.1044@TK2MSFTNGP10.phx.gbl...
>> Hello,
>>
>> In console application (Visual C++ 6.0)
>> How can I convert string to number ?
>>
>> Thanks :)
>>
>>
>
>



Re: Convert string to number by Scott

Scott
Sat May 07 08:18:10 CDT 2005

John M wrote:

> What I did before :
>
> #include <stdlib.h>
> #include <string.h>
> #include <dos.h>
> #include <stdio.h>
> #include <conio.h>
> #include "stdafx.h"
>
> and the correction :
> #include "stdafx.h"
> #include <stdlib.h>
> #include <string.h>
> #include <dos.h>
> #include <stdio.h>
> #include <conio.h>
>
> ... and things work fine.
> I don't know why I need to do this (change the "stdafx.h" to its correct
> place), but it took me long time to figure out this problem.
>
> Thanks, anyway :)

stdafx.h represents the implementation of the "precompiled header"
feature. Its purpose is to speed compiles. All those library includes
will be read and compiled every time you compile your program, and they
will be re-read and compiled for every source file that includes them.
This is a terrible burden in a large Windows program, which needs lots
of huge Microsoft headers.

The precompiled header feature works like this: Put all those standard
includes inside stdafx.h, and then include only stdafx.h in your source
files. That eliminates all recompiles of the standard headers. But for
this to work you must put #include "stdafx.h" before any other
compile-able statement in each source file.

--
Scott McPhillips [VC++ MVP]