2023-11-22

fallocate

#include <fcntl.h>
#include <unistd.h>

int main() {
  // 파일 이름
  const std::string filename = "/path/to/file.bin";

  // 파일 크기
  const int filesize = 256 * 1024 * 1024;

  // 파일 핸들
  int fd = open(filename, O_CREAT | O_RDWR, 0644);

  // 파일의 크기를 지정하여 파일을 생성
  fallocate(fd, FALLOC_FL_KEEP_SIZE, 0, filesize);

  // 파일 핸들을 닫음
  close(fd);

  return 0;
}

댓글 없음:

댓글 쓰기

암호화 + base64 하고 쉘스크립트.

 #!/bin/bash # IV와 UserKey를 설정합니다 (아스키 문자열을 그대로 사용). IV="0123456789abcdef"  UserKey="0123456789abcdef" # IV와 UserKey를 16...