Re: converting float to string

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Spartan115 wrote:
> Can anyone tell me how to convert a float to string for use with a
> TextOut() function..Thanks...(code samples would be awesome).

char s[64];
sprintf(s, "%f", yourfloat);
TextOut(... s ...


.



Relevant Pages

  • Re: weird problem
    ... I already told you that the comparison between an integer and a float ... to strcmpwhich expects a pointer to a string. ... And now a question about something else: why do you use floating ... int,float, char, etc. ...
    (comp.lang.c)
  • Re: weird problem
    ... I already told you that the comparison between an integer and a float ... And now a question about something else: why do you use floating ... use then to copy a float into a char *1. ... binary representation doesn't resemble a string like "123.46343" ...
    (comp.lang.c)
  • Re: VC++ .Net Step by Step
    ... where according to whether UNICODE and/or _UNICODE are defined whole ... TCHAR is either wchar_t or char ... TextOut is either TextOutW or TextOutA ... "abc" is a string of single byte chars ...
    (microsoft.public.vc.language)
  • Re: a newbie question.
    ... After compiled by Visual Studio, the above program can input a. ... You should not assign anything to it, because it might be stored in a place in memory to which your program cannot write, at which point it will crash (this idea can be summarized easily: never cast away the constness of string literals). ... Have a look at mallocand freeinstead, or just declare an array of char, eg. char s. ...
    (comp.lang.c)
  • Re: can anyone help me in correcting this code?
    ... char decodeLower ... float percent(int m, int n) ... string is just an array of characters terminated by '\0'. ...
    (comp.lang.c)