libs/libvtrutil/src/vtr_util.cpp
/* Date:July 17th, 2013
 * Author: Daniel Chen
 * Purpose: Checks the file extension of an file to ensure
 *            correct file format. Returns true if format is
 *            correct, and false otherwise.
 * Note:    This is probably a fragile check, but at least
 *            should prevent common problems such as swapping
 *            architecture file and blif file on the VPR
 *            command line.
 */
July 17th, 2013
Author: Daniel Chen
Purpose: Checks the file extension of an file to ensure
correct file format. Returns true if format is
correct, and false otherwise.
Note:    This is probably a fragile check, but at least
should prevent common problems such as swapping
architecture file and blif file on the VPR
command line.
July 17th 2013 Author : Daniel Chen Purpose : Checks the file extension of an file to ensure correct file format . Returns true if format is correct and false otherwise . Note : This is probably a fragile check but at least should prevent common problems such as swapping architecture file and blif file on the VPR command line .
bool check_file_name_extension(const char* file_name,
                               const char* file_extension) {
    const char* str;
    int len_extension;
    len_extension = std::strlen(file_extension);
    str = std::strstr(file_name, file_extension);
    if (str == nullptr || (*(str + len_extension) != '\0')) {
        return false;
    }
    return true;
}
bool check_file_name_extension ( const char * file_name , const char * file_extension ) { const char * str ; int len_extension ; len_extension = std :: strlen ( file_extension ) ; str = std :: strstr ( file_name , file_extension ) ; if ( str == nullptr || ( * ( str + len_extension ) != ' \0 ' ) ) { return false ; } return true ; }
Date:July 17th, 2013
 Author: Daniel Chen
 Purpose: Checks the file extension of an file to ensure
            correct file format.
Date : July 17th 2013 Author : Daniel Chen Purpose : Checks the file extension of an file to ensure correct file format .