How i can check that current file is doc, docx, xls, xlsx or pdf format? What’s a c++ library i can use for this goal in my C++ application?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to understand file’s type based on its contents, you can check the file’s binary signature.
If you want just to check the extension, you have 2 nice options:
Use std::string functions
find,find_first_of,find_last_ofandsubstrto write your own logic that analyzes the file name.Use boost filesystem library‘s function
extension.