vendredi 30 octobre 2015

C++ fread reads random characters at the beginning of the file

I have an input file like;


and I read it like this;

char a[5];
fread(a, sizeof(char), 5, input);

But when I try to print

cout << a;

it writes random characters at first like


Aucun commentaire:

Enregistrer un commentaire