|
|
Thank you nave!
I think I have got the answer:_splitpath
A Chinese VC++ programmer
|
|
|
|
|
You can use the CFileFind
CFileFind cf;
cf.FindFile("C:\\Program Files\\codeproject.txt");
cf.FindNext();
CString strFileName = cf.GetFileName();
Rgds
Abhay..
|
|
|
|
|
zengkun100 wrote: I think I have got the answer:_splitpath
MSDN Says: _splitpath is deprecated because more secure versions are available, see _splitpath_s , _wsplitpath_s .
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Though some API's have been mentioned above by our codeproject friends, u can also write such functions. If u know 'C' language very well and ofcourse, its basics (people having lot of experience also doesn't know the basics), u can easily write such functions.
Though u got the API, still I'll strongly recommend u to try writing such function.
Come online at:-
jubinc@skype
|
|
|
|
|
Don Box wrote: still I'll strongly recommend u to try writing such function.
Less u write, less will be the bugs...
|
|
|
|
|
If basics are not clear and don't have confidence, then better don't write (such simple function) and drop the programming profession.
Come online at:-
jubinc@skype
|
|
|
|
|
cool man..I just said one truth regrding the programming field.
How ever I still remeber one bug while trying to extract the file name from path. We were extracting the file name by reverse finding the "\". But later a bug was reported and reason was that, in one secnario in the path input to that function, instead of "\", seperator was "/"
|
|
|
|
|
That's right Naveen.
BTW, how many yrs of experience do u have in VC++? Do u have any Skype/Yahoo id?
Come online at:-
jubinc@skype
|
|
|
|
|
Don Box wrote: Do u have any Skype/Yahoo id?
Yahoo only... Have send my chat id to your mail box. check
|
|
|
|
|
Naveen wrote: Yahoo only... Have send my chat id to your mail box. check
To my which e-mail id? If it is skype, then there's no mail box for this. Its my skype id (just for chatting).
Come online at:-
jubinc@skype
|
|
|
|
|
No I clicked "email" option in the message board.
My chat id is nave432@yahoo.com
|
|
|
|
|
Naveen wrote: Less u write, less will be the bugs...
Write no code and you'll have absolutely no bugs.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Yes. but the damn requirments doesnt allow me to be like that
|
|
|
|
|
I do have written a function to do make the job done, but I still want to know is there some exist functions can do this job for me.
A Chinese VC++ programmer
|
|
|
|
|
_splitpath() is better option.
Come online at:-
jubinc@skype
|
|
|
|
|
You may use PathFindFileName() like this:
TCHAR *szPath = _T("C:\\Program Files\\codeproject.txt");
AfxMessageBox(PathFindFileName(szPath));
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: PathFindFileName()
Thank you Rajesh R Subramanian
I think this is the simplest way I have ever seen
A Chinese VC++ programmer
|
|
|
|
|
zengkun100 wrote: Thank you Rajesh
You're welcome.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
#include <Shlwapi.h>;<br />
#pragma comment(lib, "shlwapi.lib")<br />
<br />
LPTSTR lpszFileName = PathFindFileName(szPath);
============
Einstein
Seeing is believing.
|
|
|
|
|
Hi,
char szFilePath[MAX_PATH] = {"C:\\Program Files\\codeproject.txt"};
char szFileNameOnly = strrchr(szFilePath,'\\');
if(szFileNameOnly)
szFileNameOnly++;
now szFileName points to "codeproject.txt"
i think this works fine for u.
|
|
|
|
|
Nitheesh George wrote: char szFileNameOnly = strrchr(szFilePath,'\\');
Good, but a small correction. strrchr returns a character pointer.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
When you drag a URL from within a browser onto a windows explorer folder windows explorer creates .URL file that has the same name as what is displayed if you were to bookmark the URL. The contents of the .URL file contains the iconfile and iconindex which are somehow gotten by connecting to the URL link. What APIs are available to retrieve this information?
|
|
|
|
|
hi i have a stepper motor named "philips MB11-4786" and i dont know which circuit i should use to control it via parallel port.
is there anyone having an idea?
|
|
|
|
|
Maybe try the Hardware board[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|