fprintf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nano2
    New Member
    • Jan 2007
    • 41

    fprintf

    Hi,

    I am using sprintf like so where i want my numeric to be converted to a string
    char string[100];
    int result;
    ret = sprintf(string, "%d", result);

    does any one know if this will cause a memory leak ????


    Another question.

    is I have the following scenario -1234 is a numeric
    I want to convert this to a string like so "-1234"

    What would be the best c function to do this ????
  • radders
    New Member
    • Jan 2007
    • 13

    #2
    Originally posted by nano2
    Another question.

    is I have the following scenario -1234 is a numeric
    I want to convert this to a string like so "-1234"

    What would be the best c function to do this ????
    I think itoa would do it in C++, but not sure about C...on the other hand I've only just started programming so i could be wrong - hope not!!
    Radders

    Comment

    Working...