sprintf

This is a discussion on sprintf within the C Programming forums, part of the General Programming Boards category; If I use sprintf(My_String, "%d", 1234) do I need to use malloc first or does this happen automatically?...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    278

    sprintf

    If I use sprintf(My_String, "%d", 1234) do I need to use malloc first or does this happen automatically?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    My_String needs to point to valid memory before you call sprintf. (Looking sprintf up in any resource material you have to hand would provide the answer to the question.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sprintf overflows my buffer -- why?
    By Lasston in forum C Programming
    Replies: 26
    Last Post: 06-20-2008, 05:33 PM
  2. sprintf : garbage appended
    By yeller in forum C Programming
    Replies: 9
    Last Post: 12-17-2007, 10:21 AM
  3. sprintf in C and C++
    By usu_vlsi in forum C++ Programming
    Replies: 2
    Last Post: 03-14-2005, 04:14 AM
  4. sprintf and sscanf
    By tommy69 in forum C Programming
    Replies: 10
    Last Post: 04-22-2004, 09:00 PM
  5. Sprintf
    By Trauts in forum C++ Programming
    Replies: 10
    Last Post: 01-15-2003, 01:35 PM

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