Thread: string equivalent of sprintf()

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    54

    string equivalent of sprintf()

    is there a string equivalent of the sprintf function?

    i want to do the equivalent of sprintf(temp,"number is: %d",num);

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Check your original topic. matsp provided the way to use stringstream.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    This has already been answered in http://cboard.cprogramming.com/showthread.php?t=92709

    Could someonewith "privileges" remove this duplicate thread.

    --
    Mats

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    54
    is that the best way to do it tho? it took up quite a few lines of code. is there another way?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Further replies to the other thread please.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  2. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  3. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM