Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: String manipulation. Pin
Comp_Users8-Jul-09 1:14
Comp_Users8-Jul-09 1:14 
GeneralRe: String manipulation. Pin
Stuart Dootson8-Jul-09 1:14
professionalStuart Dootson8-Jul-09 1:14 
AnswerRe: String manipulation. Pin
Stuart Dootson8-Jul-09 1:10
professionalStuart Dootson8-Jul-09 1:10 
QuestionCHtmlEditCtrl problem :( Pin
bosfan8-Jul-09 0:10
bosfan8-Jul-09 0:10 
QuestionRe: CHtmlEditCtrl problem :( Pin
«_Superman_»8-Jul-09 0:22
professional«_Superman_»8-Jul-09 0:22 
AnswerRe: CHtmlEditCtrl problem :( Pin
bosfan8-Jul-09 0:44
bosfan8-Jul-09 0:44 
GeneralRe: CHtmlEditCtrl problem :( Pin
«_Superman_»8-Jul-09 0:59
professional«_Superman_»8-Jul-09 0:59 
QuestionHow to get the index number of a Listbox item displayed in a message box Pin
kokilag7-Jul-09 23:30
kokilag7-Jul-09 23:30 
AnswerRe: How to get the index number of a Listbox item displayed in a message box Pin
Cedric Moonen7-Jul-09 23:38
Cedric Moonen7-Jul-09 23:38 
QuestionRe: How to get the index number of a Listbox item displayed in a message box Pin
CPallini8-Jul-09 0:01
mveCPallini8-Jul-09 0:01 
JokeRe: How to get the index number of a Listbox item displayed in a message box Pin
Rajesh R Subramanian8-Jul-09 0:49
professionalRajesh R Subramanian8-Jul-09 0:49 
QuestionDrawFocusRect Pin
kumar sanghvi7-Jul-09 23:04
kumar sanghvi7-Jul-09 23:04 
AnswerRe: DrawFocusRect Pin
Naveen7-Jul-09 23:33
Naveen7-Jul-09 23:33 
GeneralRe: DrawFocusRect Pin
kumar sanghvi8-Jul-09 1:06
kumar sanghvi8-Jul-09 1:06 
GeneralRe: DrawFocusRect Pin
Naveen8-Jul-09 1:23
Naveen8-Jul-09 1:23 
GeneralRe: DrawFocusRect Pin
kumar sanghvi8-Jul-09 1:48
kumar sanghvi8-Jul-09 1:48 

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.