A
Alex Vinokur
#include <fstream>
#include <iostream>
int main()
{
const char* fileName = "out1";
std:fstream fs1(fileName);
fs1 << "AAAAAAAAAAA\n";
std::cout << fs1.tellp() << std::endl;
fs1.close();
std:fstream fs2(fileName, std::ios_base::ate);
std::cout << fs2.tellp() << std::endl;
fs2.close();
return 0;
}
gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
12
0
Why does fs2.tellp() print 0, but not 12?
Alex
#include <iostream>
int main()
{
const char* fileName = "out1";
std:fstream fs1(fileName);
fs1 << "AAAAAAAAAAA\n";
std::cout << fs1.tellp() << std::endl;
fs1.close();
std:fstream fs2(fileName, std::ios_base::ate);
std::cout << fs2.tellp() << std::endl;
fs2.close();
return 0;
}
gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
g++ file02.cpp
./a.out
12
0
Why does fs2.tellp() print 0, but not 12?
Alex