Hi,
In that case use e.g.
std::ifstream in("xmlorascii.txt");
TString xmlpreamble;
xmlpreamble.ReadLine(in);
bool isXML = xmlpreamble.BeginsWith("<?xml");
Of course you'll have to add some error handling (is the ifstream valid? etc)
Cheers, Axel.
On 5/23/11 12:05 PM, Adrian Sevcenco wrote:
> On 05/23/2011 10:16 AM, Axel Naumann wrote:
>> Hi,
>> even though I don't see how this is related to ROOT: you could check
>> whether the file starts with "<?xml". XML files don't *have* to, but >> they should, and most do.
>> >> Cheers, Axel. >> >> On 5/22/11 12:52 PM, Adrian Sevcenco wrote: >>> Hi! Is there a way to identify the file type other than using a bash >>> command like: >>> file -b $file | awk '{print $1}' >>> >>> I want to distinguish between XML and ASCII file types. >>> Thank you, >>> Adrian >>> >>> ---------------------------------------------- >>> Adrian Sevcenco | >>> Institute of Space Sciences - ISS, Romania | >>> adrian.sevcenco at {cern.ch,spacescience.ro} | >>> ---------------------------------------------- >>> >> >>
This archive was generated by hypermail 2.2.0 : Mon May 23 2011 - 17:50:01 CEST