![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Linux
南司
研二小学生
展开
-
结构体定义和使用的几种方式
因为老是忘记使用方式,所以写于此记录一下。1、定义如下,A是结构体名称,C语言中使用方式:struct A m, C++使用方式:A m。struct A{ int a;};2、定义如下,A是结构体名称,使用方式和1中一样,不同的是,在定义的时候还定义了一个变量m,可以直接使用变量m。struct A{ int a;}m;3、定义如下,用这种方式定义的结构体不能在别处定义结构体变量,但是可以使用定义结构体时给出的结构体变量m,也就是只能使用变量m。struct{ int原创 2020-07-08 10:37:24 · 1575 阅读 · 0 评论 -
Linux多进程文件拷贝(C/C++)——方案二(使用mmap内存映射)
Linux多进程文件拷贝(C/C++)——方案二(使用mmap内存映射)#include <iostream>#include <sys/mman.h>#include <unistd.h>#include <sys/types.h>#include <fcntl.h>#include <sys/stat.h>#include <string.h>using namespace std;int main原创 2020-07-01 16:17:12 · 323 阅读 · 1 评论 -
Linux多进程文件拷贝(C/C++)——方案一(不使用mmap内存映射)
代码所用函数:open(),read(),write(),fstat(),lseek(),fork(),close();#include <iostream>#include <unistd.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>using namespace std;int main(int argc,char* argv[]){ ..原创 2020-07-01 11:23:45 · 279 阅读 · 0 评论