Click here to Skip to main content
15,868,124 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have a TCHAR word. I want to remove some words in the TCHAR variable .
For example the tchar will be like this , "C:/Program Files/Sample/Smpl.exe", I want to remove the word 'Smpl.exe'. so that the new tchar word will be "C:/Program Files/Sample/".

How can i do it.

Any help will be highly appreciated.

Regards,

Jinosh
Posted
Comments
Leo Chapiro 22-Sep-15 4:02am    
Dude, that is a wrong way: show us please what have you tried and already achieved and where are you stuck?
Member 10660597 22-Sep-15 7:15am    
I have got the module file name of the application using the below method.

TCHAR pBuf[MAX_PATH];
int bytes = GetModuleFileName(NULL, pBuf, MAX_PATH);

now in this pBuf I have got the path as "C:/Program Files/Sample/Smpl.exe" but i need only the directory path ie. "C:/Program Files/Sample/". For that I have tried several split functions but it did not work.

Is there any possible way to do this.?

1 solution

Of course you have a TCHAR * variable.
I suggest you to have a look at "Shell Path Handling Functions"[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900