Thread: _snprintf

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    31

    _snprintf

    I have some code

    Code:
           char szSub[255];
    
    	_snprintf(	szSub, 
    		sizeof szSub, 
    		"SQ.%s. .CSCO",
    		m_szPart 
    		);
    where
    Code:
    char m_szPart[255];
    I want to change this function so I pass in a string which is used to build the string that is being built here. For instance...
    rather then CSCO in SQ.%s. .CSCO I could pass in MSFT and SQ.%s. .MSFT would be built. How could I do this?
    Last edited by mhandlon; 04-10-2006 at 07:49 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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