zoukankan      html  css  js  c++  java
  • ubuntu 上 新建大文件 超过2G

    /**
    author lx
    date 3.24 2011
    contact lxlenovostar@gmail.com
    biref cp a big file to anthor file.
    */

    #include
    <sys/types.h>
    #include
    <sys/stat.h>
    #include
    <fcntl.h>
    #include
    <stdlib.h>
    #include
    <unistd.h>
    #include
    <stdio.h>
    #include
    <errno.h>
    #include
    <string.h>

    #define BUFFSIZE 8192

    int main( void )
    {
    int id_write, id_read;

    id_write
    = open( "temp.pcap", O_WRONLY | O_APPEND | O_CREAT );
    id_read
    = open( "lx03.pcap", O_RDONLY );

    int n;
    char buf[BUFFSIZE];
    while ( ( n = read( id_read, buf, BUFFSIZE ) ) > 0 )
    {
    if ( write( id_write, buf, n ) != n )
    fprintf( stderr,
    "error is %s\n", strerror(errno) );
    }

    if ( n < 0 )
    printf(
    "read error\n" );

    close( id_write );
    close( id_read );

    exit(
    0 );
    }             

    编译的时候:g++ -o opencp  -D_FILE_OFFSET_BITS=64 -g opencp.cpp                                            
  • 相关阅读:
    简单破解.net(C#)程序
    URL和URI
    Java JDK安装和配置(Windows)
    函数式编程语言
    Http
    drf 序列化获取商品分类数据
    npm install 安装依赖报错
    27-----BBS论坛
    26-----BBS论坛
    25-----BBS论坛
  • 原文地址:https://www.cnblogs.com/lxgeek/p/1994230.html
Copyright © 2011-2022 走看看