Sometimes we would like to remove the trailing file name and backslash from a path. In the following, there are several different ways to make it and I am glad to share with you.
[1] MFC下的方法,使用CString类的ReserveFind、Left成员函数。
[2] C的方法,使用strrchr逆向字符串查找函数。
[3] C的方法,不适用库函数的方法,通过循环自己查找。
[4] 使用Windows的API的方法,PathRemoveFileSpec。