Any way to get rid of the null character at the end of an istream get?
问题 I'm currently trying to write a bit of code to read a file and extract bits of it and save them as variables. Here's the relevant code: char address[10]; ifstream tracefile; tracefile.open ("trace.txt"); tracefile.seekg(2, ios::beg); tracefile.get(address, 10, ' '); cout << address; The contents of the file: (just the first line) R 0x00000000 The issue I'm having is that address misses the final '0' because it puts a /0 character there, and I'm not sure how to get around that? So it outputs: