易截截图软件、单文件、免安装、纯绿色、仅160KB

linux下大文件读写源码示例

#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int main()
{
printf("sizeof(off_t) = %d\n", sizeof(off_t));
int fd = 0;
#if 1
fd = open("/root/test", O_WRONLY | O_CREAT | O_LARGEFILE, 0600);
#else
fd = open("/dev/hda1", O_RDONLY, 0600);
#endif
if (fd > 0)
{
off_t l = 0x200000001LL;
off_t l_new = lseek(fd, l, SEEK_SET);
if (l_new < 0)
printf("l_new =%d\n", l_new);
#if 1
else
write(fd, &fd, sizeof(fd));
#endif
printf("l_new = 0x%.16x\n", l_new);
close(fd);
}
struct stat st;
int ret = stat( "/root/test", &st);
printf( "\n%d--%I64u-\n", ret, st.st_size );
}


相关文档:

实战Linux Bluetooth编程(三) HCI层编程

1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI)  就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......

实战Linux Bluetooth编程(六) L2CAP编程实例

例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
 如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......

实战Linux Bluetooth编程 (七) SDP协议

Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......

Linux 内核中的 GCC 特性(转)


Linux 内核中的 GCC 特性(转)
了解用于 C 语言的 GCC 扩展
文档选项
<tr
valign="top"><td width="8"><img alt="" height="1" width="8"
src="//www.ibm.com/i/c.gif"/></td><td width="16"><img alt=&qu ......

linux 查找执行程序的当前路径

linux shell pwd 显示当前路径
假若有test.cpp
g++ test.cpp -o test
./test
想在test中找到当前执行程序所在的路径
可以再test.cpp中使用readlink函数
具体见如下实例:
#include<iostream>
#include<unistd.h>
#include<dirent.h>
#include<string.h>
#include<string>
using ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号