g4tools  5.4.0
signature
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_signature
5 #define tools_signature
6 
7 #include <string>
8 #include <cstdio>
9 
10 namespace tools {
11 namespace file {
12 
13 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.
14  FILE* file = ::fopen(a_file.c_str(),"rb");
15  if(!file) {a_num=0;return false;}
16  a_num = (unsigned int)::fread(a_head,1,a_num,file);
17  ::fclose(file);
18  return true;
19 }
20 
21 }}
22 
23 #endif
tools::file::signature
bool signature(const std::string &a_file, unsigned char a_head[], unsigned int &a_num)
Definition: signature:13
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26