vendredi 30 octobre 2015

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

I have an input file like;

A;Ali;Aksu;N;2;deposit;withdraw

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

+^%'A;




Aucun commentaire:

Enregistrer un commentaire