Time:09-24
CodePudding user response:
GetFileName. The mids (GetFileName. Find ('. ') + 1)
thank you! Quote: refer to 1st floor vcttyys response: GetFileName. Mid (GetFileName. Find ('. ') + 1) I use like this: Cstrings cs; Cs=File. GetFileName (); AfxMessageBox (File. GetFileName ()); Cs. Mid (CST. Find ('. ') + 1); AfxMessageBox (cs); Look at this time of cs is still the file name
GetFileName. Mid (GetFileName. Find ('. ') + 1)
Quote: refer to the second floor dontium response: thank you! Quote: refer to 1st floor vcttyys response: GetFileName. Mid (GetFileName. Find ('. ') + 1) I use like this: Cstrings cs; Cs=File. GetFileName (); AfxMessageBox (File. GetFileName ()); Cs. Mid (CST. Find ('. ') + 1); AfxMessageBox (cs); Look at this time of cs is still the file name This way is not rigorous, may sometimes is wrong, because some file name is likely to have more than one '. 'or'. '
thank you! Quote: refer to 1st floor vcttyys response: GetFileName. Mid (GetFileName. Find ('. ') + 1) I use like this: Cstrings cs; Cs=File. GetFileName (); AfxMessageBox (File. GetFileName ()); cs. Mid (CST) Find ('. ') + 1); AfxMessageBox (cs); CodePudding user response: Be careful in the file. The file, CodePudding user response: Recommended by the first post, 4/f, easy to understand CodePudding user response: reference paschen reply: 3/f Quote: refer to the second floor dontium response: thank you! Quote: refer to 1st floor vcttyys response: GetFileName. Mid (GetFileName. Find ('. ') + 1) I use like this: Cstrings cs; Cs=File. GetFileName (); AfxMessageBox (File. GetFileName ()); Cs. Mid ( CST. Find (') + 1); AfxMessageBox (cs); Look at this time of cs is still the file name This way is not rigorous, may sometimes is wrong, because some file name is likely to have more than one '. 'or'. ' So if you have more than one point could not find, if there is no extension, will go wrong? CodePudding user response: Use strtok or strtok_s cstrings string segmentation CodePudding user response: Cstrings cs=File. GetFileName (); Cstrings ext=: : PathFindExtension (cs) (LPCTSTR); PathFindExtension Shell Path Handling Functions provides
Quote: refer to the second floor dontium response: thank you! Quote: refer to 1st floor vcttyys response: GetFileName. Mid (GetFileName. Find ('. ') + 1) I use like this: Cstrings cs; Cs=File. GetFileName (); AfxMessageBox (File. GetFileName ()); Cs. Mid ( CST. Find (') + 1); AfxMessageBox (cs); Look at this time of cs is still the file name This way is not rigorous, may sometimes is wrong, because some file name is likely to have more than one '. 'or'. '
thank you! Quote: refer to 1st floor vcttyys response: GetFileName. Mid (GetFileName. Find ('. ') + 1) I use like this: Cstrings cs; Cs=File. GetFileName (); AfxMessageBox (File. GetFileName ()); Cs. Mid ( CST. Find (') + 1); AfxMessageBox (cs); Look at this time of cs is still the file name
Page link:https//www.codepudding.com/Softwareengineering/26170.html