file_operations
Abstract
This file contains the file operations.
このファイルでは,ファイルへの操作を収録します.
Header file
namespace sstd{
bool file_size(size_t& ret_size, const char* path);
}
Description
| Function name | Description |
|---|---|
| file_size() | gets the size of the file in the path. path に指定されたファイルのサイズを取得します. |
Usage
- main.cpp
#include <sstd/sstd.hpp> int main(){ sstd::mkdir("./tmp"); const char* path = "./tmp/dummy_file"; sstd::system(sstd::ssprintf("head -c 19842 /dev/urandom > %s", path)); // generate 19842 Byte random file size_t ret_size=0ull; bool ret = sstd::file_size(ret_size, path); sstd::printn(ret); sstd::printn(ret_size); return 0; } - Execution result
ret = true ret_size = 19842