Thread: Does vaprintf support %s??

  1. #1
    Registered User
    Join Date
    Nov 2001

    Does vaprintf support %s??

    When I use vaprintf in a text print function that has the multiple argument thing, and I use %s in the input text, with it's respective char string, it doesn't work(the print function doesn't display it). I have had this problem before, but now I actually care. So does vaprintf support %s or do I have to use something else? Thanks alot!

    Print(GLint x, GLint y, const char *string, ...)	// Where The Printing Happens
    char		text[256];
    	va_list		ap;										// Pointer To List Of Arguments
    	if (string == NULL)									// If There's No Text
    		return;											// Do Nothing
    	va_start(ap, string);									// Parses The String For Variables
    	    vsprintf(text, string, ap);						// And Converts Symbols To Actual Numbers
    //There's more to this I just edited it out
    //And I call it like:
    Print(100,100, "console: %s", console[CurrentLine].string);

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Yes it does

    > Print(100,100, "console: %s", console[CurrentLine].string);
    - console[CurrentLine].string have a \0
    - is the combined result < 256 chars


    char text[256];

    Should be bigger for your use

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  3. Dev-cpp - compiler options
    By tretton in forum C Programming
    Replies: 7
    Last Post: 01-06-2006, 05:20 PM
  4. Replies: 1
    Last Post: 09-25-2003, 08:25 AM
Website Security Test