Skip to content

Instantly share code, notes, and snippets.

@tst-jlarocco
Created February 5, 2019 01:23
Show Gist options
  • Save tst-jlarocco/d2cb74a82713211a26908b0a10c7da74 to your computer and use it in GitHub Desktop.
Save tst-jlarocco/d2cb74a82713211a26908b0a10c7da74 to your computer and use it in GitHub Desktop.
Test lseek64
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
int main(int argc, char *argv[]) {
if (argc != 2) {
std::cout << "No input file given!\n";
return 1;
}
int fd = open(argv[1], O_RDONLY);
uint64_t file_size = lseek64(fd, 0, SEEK_END);
close(fd);
std::cout << "File size: " << file_size << "\n";
return 0;
}
bigfile: bigfile.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment