Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Microsoft Windows 3.0 and Visual C++ 1.0 Pin
Joe Woodbury8-Jul-09 6:57
professionalJoe Woodbury8-Jul-09 6:57 
GeneralRe: Microsoft Windows 3.0 and Visual C++ 1.0 Pin
Ahmed Charfeddine8-Jul-09 7:01
Ahmed Charfeddine8-Jul-09 7:01 
GeneralRe: Microsoft Windows 3.0 and Visual C++ 1.0 Pin
Joe Woodbury8-Jul-09 7:06
professionalJoe Woodbury8-Jul-09 7:06 
QuestionConvert LPRECT to Crect Pin
kumar sanghvi8-Jul-09 2:38
kumar sanghvi8-Jul-09 2:38 
AnswerRe: Convert LPRECT to Crect Pin
Cedric Moonen8-Jul-09 2:51
Cedric Moonen8-Jul-09 2:51 
GeneralRe: Convert LPRECT to Crect Pin
kumar sanghvi8-Jul-09 3:04
kumar sanghvi8-Jul-09 3:04 
AnswerRe: Convert LPRECT to Crect Pin
Adam Roderick J8-Jul-09 2:52
Adam Roderick J8-Jul-09 2:52 
QuestionRe: Convert LPRECT to Crect Pin
CPallini8-Jul-09 3:16
mveCPallini8-Jul-09 3:16 
AnswerRe: Convert LPRECT to Crect Pin
CPallini8-Jul-09 3:18
mveCPallini8-Jul-09 3:18 
QuestionTextWidth Pin
kumar sanghvi8-Jul-09 0:56
kumar sanghvi8-Jul-09 0:56 
AnswerRe: TextWidth Pin
Rajesh R Subramanian8-Jul-09 0:58
professionalRajesh R Subramanian8-Jul-09 0:58 
AnswerRe: TextWidth Pin
David Crow8-Jul-09 2:36
David Crow8-Jul-09 2:36 
Questionhow to shut down the PC programatically. Pin
saksp8-Jul-09 0:44
saksp8-Jul-09 0:44 
AnswerRe: how to shut down the PC programatically. Pin
Madhu Nair8-Jul-09 0:50
Madhu Nair8-Jul-09 0:50 
GeneralRe: how to shut down the PC programatically. Pin
«_Superman_»8-Jul-09 0:51
professional«_Superman_»8-Jul-09 0:51 
JokeRe: how to shut down the PC programatically. Pin
Madhu Nair8-Jul-09 0:55
Madhu Nair8-Jul-09 0:55 
GeneralRe: how to shut down the PC programatically. Pin
saksp8-Jul-09 1:34
saksp8-Jul-09 1:34 
AnswerRe: how to shut down the PC programatically. Pin
Madhu Nair8-Jul-09 2:00
Madhu Nair8-Jul-09 2:00 
AnswerRe: how to shut down the PC programatically. Pin
«_Superman_»8-Jul-09 0:50
professional«_Superman_»8-Jul-09 0:50 
QuestionIWebBrowser2 problem Pin
YaronNir8-Jul-09 0:41
YaronNir8-Jul-09 0:41 
AnswerRe: IWebBrowser2 problem Pin
Madhu Nair8-Jul-09 0:45
Madhu Nair8-Jul-09 0:45 
GeneralRe: IWebBrowser2 problem Pin
YaronNir8-Jul-09 0:53
YaronNir8-Jul-09 0:53 
GeneralRe: IWebBrowser2 problem Pin
YaronNir8-Jul-09 1:58
YaronNir8-Jul-09 1:58 
QuestionString manipulation. Pin
Comp_Users8-Jul-09 0:32
Comp_Users8-Jul-09 0:32 
Hi Guys,

I want to write an function which will accept an file name(along with complete path), append an prefix to it (say Admin to the file name from c:\Sample\sam.txt to c:\Sample\Adminsam.txt). I have written an function via character array manipulation and given below.

<br />
#define ADMIN_PREFIX			_T("Admin")<br />
static void RenameToAdminFile(LPCTSTR szFilePath/*in*/, LPTSTR szAdminFilePath/*out*/)<br />
{<br />
    TCHAR szTempFilePath[MAX_PATH] = _T(""), *pCh;<br />
	TCHAR szFileName[MAX_PATH] = _T("");<br />
	_tcscpy(szTempFilePath, szFilePath);<br />
	bool bValidPath = false;<br />
	<br />
    if (pCh = _tcsrchr( szTempFilePath, _T('\\')))<br />
    {<br />
        pCh++; // Keep trailing "\\"<br />
		_tcscpy(szFileName, pCh);<br />
        *pCh = _T('\0');<br />
		bValidPath = true;<br />
    }<br />
    else<br />
    {<br />
        if (pCh = _tcsrchr( szTempFilePath, _T(':')))<br />
        {<br />
            pCh++; // Keep trailing ":"<br />
			_tcscpy(szFileName, pCh);<br />
            *pCh = _T('\0');<br />
            _tcscat(szTempFilePath, _T("\\"));<br />
			bValidPath = true;<br />
        }<br />
        else<br />
        {<br />
            *szTempFilePath=_T('\0');<br />
        }<br />
    }<br />
	if(bValidPath)<br />
	{<br />
		TCHAR szTempAdminFileName[MAX_PATH] = ADMIN_PREFIX;<br />
		_tcscat(szTempAdminFileName, szFileName);<br />
		_tcscat(szTempFilePath, szTempAdminFileName);<br />
	}<br />
	_tcscpy(szAdminFilePath, szTempFilePath);<br />
	return;<br />
}


Are there any STL API's (Not CString methods)that I could use to achieve the same? An code snippet will be of great help.
AnswerRe: String manipulation. Pin
«_Superman_»8-Jul-09 0:49
professional«_Superman_»8-Jul-09 0:49 

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.