How extract the name of a file

Hi all,

I am beginner on C++ and linux and one of my tasks is extract the name of a file and compare if it is a new version or not. For example, the file name will be update_1.0.0.1.tar and I need to get the "" portion to compare if it is the expected version or not.

Also, the path of my file will always be different, since the version number will change and i cant use /home/user/sample/temp/update_1.0.0.1.tar. How I address this also? can I do something like: /home/user/sample/temp/update_*.tar?

I am sorry, i think it would reach different people.
Registered users can post here. Sign in or register to post.