Warning, /include/Geant4/tools/signature is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_signature
0005 #define tools_signature
0006
0007 #include <string>
0008 #include <cstdio>
0009
0010 namespace tools {
0011 namespace file {
0012
0013 inline bool signature(const std::string& a_file,unsigned char a_head[],unsigned int& a_num){ //it is assumed a_head[] can contain a_num chars.
0014 FILE* file = ::fopen(a_file.c_str(),"rb");
0015 if(!file) {a_num=0;return false;}
0016 a_num = (unsigned int)::fread(a_head,1,a_num,file);
0017 ::fclose(file);
0018 return true;
0019 }
0020
0021 }}
0022
0023 #endif