0

Can someone help or point me in the right direction?

I am trying to read in 16 numbers from a .txt file( all 1's and 0's) and store each one into an array. here is what I am currently trying

char a[16], b[16] = { 0 };
char c = 0;
ifstream indat;
indat.open("test.txt");
for (int i = 0; i != 16; i++)
    {
    // cout << "enter nums";
    indat.get(c);
    a[i] = c;
    }
indat.close();
for (int i = 0; i != 16; i++)
    cout << a[i] << endl;
system("pause");

example of what I am trying to read in 1110100111010110

I've been getting a bunch of random crap printing in the console with this

0 Answers0