FTKのテストコード2
xsiファイルのテキスト・バイナリを判別する
#include <iostream> #include <stdio.h> #include <XSIParser.h> #include <dotXSITemplate.h> #include <dotXSIParam.h> #include <dotXSIParams.h> #include <SIBCUtil.h> using namespace std; void main(int argc, char *argv[]) { CXSIParser *parser = new CXSIParser; SI_Error result = SI_SUCCESS; parser->SetOpenMode(OPEN_READ); _SI_CALL(parser->Open(_SI_TEXT("aaa.xsi")), "CXSIParser::Open"); if(result != SI_SUCCESS) { fprintf(stderr, "Error opening the file\n"); exit(1); } _SI_CALL(parser->Read(), "CXSIParser::Read"); if(result != SI_SUCCESS) { fprintf(stderr, "Error reading the file\n"); parser->Close(); exit(1); } _SI_CALL(parser->Close(), "CXSIParser::Close"); if(parser->GetdotXSIFormat() == FORMAT_TEXT) { printf("ファイルはテキスト\n"); } else if(parser->GetdotXSIFormat() == FORMAT_BINARY) { printf("ファイルはバイナリ\n"); } delete parser; }