string equivalent of sprintf()

This is a discussion on string equivalent of sprintf() within the C++ Programming forums, part of the General Programming Boards category; is there a string equivalent of the sprintf function? i want to do the equivalent of sprintf(temp,"number is: %d",num);...

  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,211
    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 Function with char *

    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,489
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 09:33 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 02:23 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 01:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21