Thread: sprintf

  1. #1
    Registered User
    Join Date
    Oct 2008


    is it possible to make sprintf hold more than 1 string , like use it like an array.
    or is there any other way to create an array which can hold both integers and chars and not change their values ??

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    What does that even mean?

    sprintf is a function that returns a string. What you do with that string is up to you.

    Arrays by definition must have every element of the same type.

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    But remember that a char array can hold strings, integer and floating point numbers (all as strings, of course). It is the closest thing you can get to a generic array.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Hacker MeTh0Dz's Avatar
    Join Date
    Oct 2008
    Potentially you could use an array of an union and then just put the potential types in the union definition.

    Although it may not be exactly what you want.

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, 04: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, 08:00 PM
  5. Sprintf
    By Trauts in forum C++ Programming
    Replies: 10
    Last Post: 01-15-2003, 01:35 PM