FUNCTION
file_Length_Cpp
Calculate the length of C++ - style files
You're viewing an older version of this page (#294). View the current version.
Interface
#include <codecogs/computing/io/binary/file_length_cpp.h>
using namespace Computing::Io::Binary;
The C++ - version of Will Bateman's File_Length
\copydoc binary/file_length
References
fileLength
Example 1
#include <iostream>
#include <fstream>
#include <codecogs/computing/io/binary/file_length_cpp.h>
using namespace std;
int main(int argc, char** argv)
{
if(argc < 2) return (-1);
fstream a(argv[1]);
cout <<"The file "<<argv[1]
<<" is "<<fileLengthCpp(&a)
<<"bytes long."<<endl;
return (0);
}Parameters
file
is a pointer referring to a C++ fstream object.
Returns
fileLengthCpp returns the length of the input file in bytes. On failure it returns -1.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.