Click here to Skip to main content
15,888,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to wait for thread & if no response within time abort it Pin
karmendra_js14-Sep-05 23:03
karmendra_js14-Sep-05 23:03 
GeneralRe: How to wait for thread & if no response within time abort it Pin
Roger Stoltz14-Sep-05 23:22
Roger Stoltz14-Sep-05 23:22 
GeneralRe: How to wait for thread & if no response within time abort it Pin
karmendra_js14-Sep-05 23:43
karmendra_js14-Sep-05 23:43 
GeneralRe: How to wait for thread & if no response within time abort it Pin
Roger Stoltz15-Sep-05 1:53
Roger Stoltz15-Sep-05 1:53 
QuestionAbout CString : Plz Send Urgently Pin
parims14-Sep-05 19:08
parims14-Sep-05 19:08 
AnswerRe: About CString : Plz Send Urgently Pin
karmendra_js14-Sep-05 19:45
karmendra_js14-Sep-05 19:45 
AnswerRe: About CString : Plz Send Urgently Pin
prasad_som14-Sep-05 19:51
prasad_som14-Sep-05 19:51 
AnswerRe: About CString : Plz Send Urgently Pin
kakan14-Sep-05 20:03
professionalkakan14-Sep-05 20:03 
Why don't you check out the Class Members in CString?

Well, here goes:

Solution 1, CString:
CString cs = "C:\\MyDocuments\\myDialog\\release\\myapp.exe";
CString pureFileName;

int lastSlashOffset = cs.ReverseFind((TCHAR) '\\');
if(lastSlashOffset >= 0 && cs.GetLength > (lastSlashOffset + 1)) {
pureFileName = cs.Mid(pureFileName + 1);
}
// pureFileName contains the file name.

Solution 2 (good old splitpath):
#include <stdlib.h>
#include <stdio.h>

void main( void )
{
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];

strcpy(path_buffer, "C:\\MyDocuments\\myDialog\\release\\myapp.exe");
_splitpath( path_buffer, drive, dir, fname, ext );
printf( "Path extracted with _splitpath:\n" );
printf( " Drive: %s\n", drive );
printf( " Dir: %s\n", dir );
printf( " Filename: %s\n", fname );
printf( " Ext: %s\n", ext );
}


Output

Path extracted with _splitpath:
Drive: c:
Dir: \MyDocuments\myDialog\release\
Filename: myapp
Ext: .exe
AnswerRe: About CString : Plz Send Urgently Pin
vikas amin15-Sep-05 1:11
vikas amin15-Sep-05 1:11 
JokeRe: About CString : Plz Send Urgently Pin
prasad_som15-Sep-05 2:16
prasad_som15-Sep-05 2:16 
AnswerRe: About CString : Plz Send Urgently Pin
YoSilver15-Sep-05 14:35
YoSilver15-Sep-05 14:35 
GeneralRe: About CString : Plz Send Urgently Pin
ThatsAlok15-Sep-05 18:11
ThatsAlok15-Sep-05 18:11 
Questionwhy does only a part of VARIANT change from VT_DATE to VT_BSTR? Pin
liuyue14-Sep-05 18:43
liuyue14-Sep-05 18:43 
Questionwrite Text on sphere Pin
cofd14-Sep-05 18:42
cofd14-Sep-05 18:42 
AnswerRe: write Text on sphere Pin
User 58385214-Sep-05 18:46
User 58385214-Sep-05 18:46 
GeneralRe: write Text on sphere Pin
cofd14-Sep-05 19:00
cofd14-Sep-05 19:00 
GeneralRe: write Text on sphere Pin
cofd14-Sep-05 19:11
cofd14-Sep-05 19:11 
Questiona vss question Pin
followait14-Sep-05 17:39
followait14-Sep-05 17:39 
QuestionI've written a service and it can't access mapped network drives. Why? Pin
zhaopi14-Sep-05 17:26
zhaopi14-Sep-05 17:26 
QuestionSir,can you help me Pin
momer14-Sep-05 14:49
momer14-Sep-05 14:49 
AnswerRe: Sir,can you help me Pin
Christian Graus14-Sep-05 16:30
protectorChristian Graus14-Sep-05 16:30 
AnswerRe: Sir,can you help me Pin
Trollslayer14-Sep-05 21:51
mentorTrollslayer14-Sep-05 21:51 
JokeRe: Sir,can you help me Pin
ThatsAlok14-Sep-05 22:42
ThatsAlok14-Sep-05 22:42 
QuestionFile checking Pin
benjnp14-Sep-05 14:23
benjnp14-Sep-05 14:23 
AnswerRe: File checking Pin
ThatsAlok14-Sep-05 18:39
ThatsAlok14-Sep-05 18:39 

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.