Click here to Skip to main content
15,914,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: uint16_t Pin
ikbahrian11-Jan-07 6:10
ikbahrian11-Jan-07 6:10 
AnswerRe: uint16_t Pin
Cedric Moonen11-Jan-07 0:09
Cedric Moonen11-Jan-07 0:09 
AnswerRe: uint16_t Pin
John R. Shaw11-Jan-07 15:15
John R. Shaw11-Jan-07 15:15 
QuestionStrange 'minimize button' action. Pin
PatrykDabrowski10-Jan-07 23:27
PatrykDabrowski10-Jan-07 23:27 
AnswerRe: Strange 'minimize button' action. Pin
prasad_som10-Jan-07 23:47
prasad_som10-Jan-07 23:47 
QuestionRe: Strange 'minimize button' action. Pin
PatrykDabrowski11-Jan-07 0:04
PatrykDabrowski11-Jan-07 0:04 
GeneralRe: Strange 'minimize button' action. Pin
prasad_som11-Jan-07 2:43
prasad_som11-Jan-07 2:43 
QuestionStrange problem with sprintf Pin
Waldermort10-Jan-07 22:32
Waldermort10-Jan-07 22:32 
I have created a class whos duty is to return a full path to the requested file. In the C'tor I allocate a string and store the exe's folder. Since strings are often returned there is a szReturnBuffer[MAX_PATH] buffer. In later calls to the methods I build a path from the earlier retrieved path and append the file/directory.

Here's the relevent code:
CGameSettings::CGameSettings( void )
{
    m_szLocalDirectory = NULL;
    DWORD dwLen = ::GetModuleFileName( NULL, m_szReturnBuffer, sizeof(m_szReturnBuffer) );
    if ( dwLen )
    {
        ::PathRemoveFileSpec( m_szReturnBuffer );
        ::PathAddBackslash( m_szReturnBuffer );

        dwLen = (DWORD)_tcslen( m_szReturnBuffer ) + 1;
        m_szLocalDirectory = new TCHAR [ dwLen ];

        if ( m_szLocalDirectory )
            _stprintf_s( m_szLocalDirectory, dwLen, _T("%s"), m_szReturnBuffer );
    }
}

LPCTSTR CGameSettings::GetBkgndFolder( void )
{
    if ( ! m_szLocalDirectory )
        return NULL;
    _stprintf_s(
        m_szReturnBuffer,
        sizeof(m_szReturnBuffer),
        _T("%s%s"),
        m_szLocalDirectory,
        _T("Art\\Background\\") );
	
    return m_szReturnBuffer;
}


m_szReturnBuffer contains the correct path, but the _stprintf_s somehow sets the m_szLocalDirectory to 0xfdfdfdfd. What could be causing this?
AnswerRe: Strange problem with sprintf Pin
Waldermort10-Jan-07 23:15
Waldermort10-Jan-07 23:15 
GeneralRe: Strange problem with sprintf Pin
prasad_som10-Jan-07 23:36
prasad_som10-Jan-07 23:36 
AnswerRe: Strange problem with sprintf Pin
prasad_som10-Jan-07 23:15
prasad_som10-Jan-07 23:15 
AnswerRe: Strange problem with sprintf Pin
Stephen Hewitt11-Jan-07 12:10
Stephen Hewitt11-Jan-07 12:10 
QuestionPrograming for SmartPhone? Pin
bosfan10-Jan-07 22:29
bosfan10-Jan-07 22:29 
AnswerRe: Programing for SmartPhone? [modified] Pin
Rajesh R Subramanian10-Jan-07 22:38
professionalRajesh R Subramanian10-Jan-07 22:38 
QuestionHow can i terminate a Services using other service [modified] Pin
Kotesh.N10-Jan-07 22:12
Kotesh.N10-Jan-07 22:12 
AnswerRe: How can i terminate a Services using other service Pin
neilsolent11-Jan-07 2:27
neilsolent11-Jan-07 2:27 
GeneralRe: How can i terminate a Services using other service Pin
Kotesh.N11-Jan-07 19:18
Kotesh.N11-Jan-07 19:18 
GeneralRe: How can i terminate a Services using other service Pin
neilsolent13-Jan-07 0:32
neilsolent13-Jan-07 0:32 
AnswerRe: How can i terminate a Services using other service Pin
Hamid_RT11-Jan-07 18:52
Hamid_RT11-Jan-07 18:52 
GeneralRe: How can i terminate a Services using other service Pin
Kotesh.N11-Jan-07 19:20
Kotesh.N11-Jan-07 19:20 
GeneralRe: How can i terminate a Services using other service Pin
Hamid_RT11-Jan-07 20:35
Hamid_RT11-Jan-07 20:35 
QuestionDisplaying a form Form a Form ? Pin
Fritzables10-Jan-07 22:02
Fritzables10-Jan-07 22:02 
AnswerRe: Displaying a form Form a Form ? Pin
Kotesh.N10-Jan-07 22:17
Kotesh.N10-Jan-07 22:17 
GeneralRe: Displaying a form Form a Form ? Pin
Fritzables10-Jan-07 22:20
Fritzables10-Jan-07 22:20 
GeneralRe: Displaying a form Form a Form ? Pin
Kotesh.N10-Jan-07 22:34
Kotesh.N10-Jan-07 22:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.