Link to home
Start Free TrialLog in
Avatar of Paladin_VB
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
ASKER CERTIFIED SOLUTION
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jase-Coder
Jase-Coder

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;
 }
Avatar of Paladin_VB

ASKER

Thanks to to all who replied
Glad to help.