I have an xml file whose contents are
<Body>
<Head1>Some Heading</Head1>
<Body1>
<K1>V1</K1>
<K2>V2</K2>
</Body1>
</Body>
when I read this file into a buffer(which is a char array in C) using fread similar to this code: Reading the whole text file into a char array in C I obtain a c buffer which contain whitespace. is there a way the additional whitespace which are coming on the left in the XML file be removed by loading into the buffer?
EDIT: I earlier used fgets to read the file line by line, removed the whitespaces on the left and concatenated. it worked, but is there a better way?