-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi,
I have a standard bit of fstream code that .fail()s on some machines to write to a file when on a network path. It is not a network permission issue.
Any ideas?
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
What's the correct way to check for a general error when sending data to an fstream?
I have the following code, which seems a bit overkill.
int Saver::output()
{
save_file_handle.open(file_name.c_str());
if (save_file_handle.is_open())
{
save_file_handle << save_str.c_str();
…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have a text file named num.txt who's only contents is the line 123. Then I have the following:
void alt_reader(ifstream &file, char* line){
file.read(line, 3);
cout << "First Time: " << line << endl;
}
int main() {
ifstream inFile;
int num;
inFile.open("num…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Everytime I read in by fstream I got 1 extra character at the end, How can I avoid this?
EDIT:
ifstream readfile(inputFile);
ofstream writefile(outputFile);
char c;
while(!readfile.eof()){
readfile >> c;
//c = shiftChar(c, RIGHT, shift);
writefile << c;
}
readfile.close();
writefile…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi, please, what contains the fstream variable? A can find many tutorials on fstream, but no ona actually says what is the fstream file; declaration in the beginning. Thanks.
>>> More