Since you are using the strtok() function (a not too much liked function
by the way, since it modifies the string), I assume that you are writing
in C.
Either use atoi() or strtol() to convert from string to number.
Note that atoi() breaks at first non-numeric character, so in case you use
it with a string that doesn't contain a number, you must manually check
the contents of the string.
strtol() will set a pointer to the first non-converted character, which
helps when continuing the processing of the string.
/Per W
On Tue, 9 May 2006, KrowniX ()--() wrote:
> Hi ...
>
> Hey..today I got some other problem that you may help-me...I am working t=
o use the response of the ping command to do some operations....for example=
:
>
> Resposta de 10.0.0.1: bytes=3D32 tempo=3D49ms TTL=3D250
> Resposta de 10.0.0.1: bytes=3D32 tempo=3D48ms TTL=3D250
> Resposta de 10.0.0.1: bytes=3D32 tempo=3D48ms TTL=3D250
> Resposta de 10.0.0.1: bytes=3D32 tempo=3D49ms TTL=3D250
>
> I already know the function strtok() in string.h that allowed you to cut =
the file as you want...and i don=B4t have problems to separate the "tempo=
=3D49ms" from the rest of the file..so..that=B4s my question..
>
> the strtok() function returns a char*, and I need to use that number "49"=
to make some basics operations like > < .;...really simple.. but I am not =
been able to do the conversion of char* to int...
>
> Does anyone know how do I do this??
>
> Thanks....and if I found out I=B4ll post it here..
>
> Krownix
|