Paladin_VB
asked on
Converting Float to (char*) for Winsock sendv() + recv()
As I cannot type cast , Is there any way to do this ? Is there any function I can use to do this ? Is there any alternative network commands I can use to send floats ?
Thanks Mark
Thanks Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
could you not use atof()
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
float f;
char *str = "5432.123";
f = atof(str);
printf("string = %s float = %f\n", str, f);
return 0;
}
#include <stdio.h>
int main(void)
{
float f;
char *str = "5432.123";
f = atof(str);
printf("string = %s float = %f\n", str, f);
return 0;
}
ASKER
Thanks to to all who replied
Glad to help.