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

linux 进程间共享内存

可以采用sysV的shmget + shmat 实现。
但是我更喜欢shm_open + mmap 更简单。
#---------------------writer.c----------------------------
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
struct ofs_stat
{
  int a;
  int b;
  int c;
};
int main(void)
{
        int fd;
    int count = 0;
    struct ofs_stat stat={0};
    struct ofs_stat *s;
    void *region=NULL;
    char *name;
        if((fd=shm_open("ofs_mmm", O_TRUNC|O_CREAT|O_RDWR,0644))==-1) {
      perror("open");
      exit(1);
        }
    ftruncate(fd, sizeof(stat));
    region = mmap(NULL, sizeof(struct stat), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
    if(region == (caddr_t)-1) {
      perror("mmap");
      shm_unlink("ofs_mmm");
      return 1;
    }
    s = (struct ofs_stat *)region;
    while(1) {
      s->a=count++;
      printf("%d \n",s->a);
      sleep(1);
    }
        shm_unlink("ofs_mmm");
    return 0;
}
#--------------------reader.c----------------------------
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
struct ofs_stat
{
  int a;
  int b;
&


相关文档:

实战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桌面操作过程录制的文件

Linux系统越来越受到电脑用户的欢迎,于是很多人开始学习Linux时,在很多时候,我们需要将在Linux桌面上的操作过程录制下来,比如制作屏幕
演示、视频教学等。这里将介绍在Linux桌面下值得使用的5个屏幕录像软件,包括Istanbul、Wink、Xvidcap、Vnc2swf、
Recordmydesktop,希望对有此需求的朋友提供参考。
  Istanbul ......

Linux基本指令

Linux基本指令
alias
替指令取别名
◎ alias 列出目前系统所使用的所有指令别名
◎ alias 别名=Linux 指令名称 此时若输入「别名」则功能会跟输入「Linux 指令名称」相同
◎ 若想要每次开机都使用此别名,在 bash 中,一定要在 .bashrc 中指定,如果是 tcsh 中,则要在 .cshrc 中指定
ar
将许多档案备存成一个或多个 ......

Linux下RTP编程

流媒体指的是在网络中使用流技术传输的连续时基媒体,其特点是在播放前不需要下载整个文件,而是采用边下载边播放的方式,它是视频会议、IP电话等
应用场合的技术基础。RTP是进行实时流媒体传输的标准协议和关键技术,本文介绍如何在Linux下利用JRTPLIB进行实时流媒体编程。
 
     &nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号