自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 资源 (2)
  • 收藏
  • 关注

原创 多进程并发服务器(笔记)

服务器大致流程图#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <pthread.h>#include <errno.h>#include <signal.h>#include <ctype.h>#include <strings.h>#include &l.

2021-03-14 15:40:42 121

原创 多进程并发服务器(笔记)

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <pthread.h>#include <ctype.h>#include <arpa/inet.h>#include <fcntl.h>#include <errno.h>#define SERV_PORT 800

2021-03-14 15:23:43 187

原创 qt项目-利用MySQL与XML实现车辆管理系统

效果展示数据库数据利用XML文档记录销售记录carmanager.cpp 文件#include "carmanager.h"#include "ui_carmanager.h"#include <QMessageBox>#include <QSqlError>#include <QSqlQuery>#include <QSqlQueryModel>#include <QSqlTableModel>.

2021-03-14 00:06:18 532

原创 利用opendir与readdir函数实现ls功能

函数原型DIR *opendir(char *name);int closedir(DIR *dp);struct dirent *readdir(DIR *dp);struct dirent{inodechar dname[256]}#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <pthread..

2021-03-13 16:52:11 558

原创 web服务器框架

web服务器实现步骤#include <stdio.h>#include <string.h>#include <stdlib.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/wait.h>#include <errno.h>#include <sys/types.h>#include <sys/stat.h&.

2021-03-13 16:35:35 289

原创 fcntl()不用重新打开文件就能修改文件属性

普通文件不会阻塞fcntl:int flags = fcntl(fd, F_GETFL);flags |= O_NONBLOCK; 位图–二进制位int ret = fcntl(fd, F_SETFL, flags);获取文件状态: F_GETFL设置文件状态: F_SETFL#icnlude <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#.

2021-03-13 14:45:58 114

原创 利用unlink特性创建temp文件

函数原型int unlink(const char *pathname);执行unlink()函数后删除文件,先检查文件系统中该文件的连接数是否为1,如果不是1说明此文件还有其他链接对象,因此只对此文件的连接数进行减1操作。若连接数为1,并且在此时没有任何进程打开该文件,此内容才会真正地被删除掉。在有进程打开此文件的情况下,则暂时不会删除,直到所有打开该文件的进程都结束时文件就会被删除。#include <stdio.h>#include <stdlib.h>#in.

2021-03-12 23:17:53 106

原创 stat()函数 获取文件类型

1.函数原型int stat(const char *path, struct stat *buf);2.函数结构体struct stat {dev_t st_dev; /* ID of device containing file /ino_t st_ino; / inode number /mode_t st_mode; / protection /nlink_t st_nlink; / number of hard links /.

2021-03-12 23:07:12 776

原创 lseek函数:

/*lseek函数: 文件偏移 linux中可以使用系统函数lseek来修改文件偏移量(读写位置)  fseek的作用及参数 SEEK_SEK SEEK_CUR SEEK_END int fseek(FILE *stream, long offset, int whence)成功返回0,失败-1 特别:超出文件末尾位置返回 0;往回超出文件头位置返回-1  off_t lseek(int f

2021-03-12 22:53:23 224

原创 2021-03-12

函数原型int truncate(const char *path,off_t length);#include <stdio.h>#include <srdlib.h>#include <string.h>#include <unistd.h>int main(){ int ret = truncate("filename",250); //文件名 文件大小 return 0;}

2021-03-12 22:45:16 77

原创 利用lseek函数获取文件大小

#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <unistd.h>#include <fcntl.h>int main(int argc char *argv[]){ int fd = open(argv[1], O_RDWR); if(fd == -1) { perror("open er

2021-03-12 22:39:04 724

原创 利用read、write函数实现copy功能

ssize_t read(int fd, void *buf, size_t count);参数:fd:文件描述符buf:存数据的缓冲区count:缓冲区的大小返回值:0 读到文件末尾成功; >0 实际从fd读到的数据大小失败:-1,并设置errno将文件设置为非阻塞,当read没有数据时返回-1 且errno设置为EAGAIN or EWOULDBLOCKssize_t write(int fd, const void *buf, size_t count);参数:fd.

2021-03-12 22:32:12 368

原创 文件设置为非阻塞

#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <fcntl.h>#include <unistd.h>#define MSG_TRY "try again\n"#define MSG_TIMEOUT "time out\n"int main(int argc, char *argv[]){ ch

2021-03-12 22:25:09 219

原创 read()与write()

#####1. 回显STDIN_FILENO事件#include <stdio.h>#include <stdlib.h>int main(int argc, char *argv[]){ int n; char buf[10]; while((n = read(STDIN_FILENO, buf, 10)) != 0) //读取 输入设备的数据 { //将将键盘输入设备获取到的数据打印到屏幕中 write(STDOUT_FILENO, buf, n);

2021-03-12 22:00:42 130

原创 fopen()函数

open()函数1.函数原型FILE *fopen(const char *path, const char *mode);

2021-03-12 21:53:21 516

原创 open()函数

open函数

2021-03-12 18:06:00 145

原创 在window平台修改MySQL

快捷键:ctrl + alt + delete 进入任务管理器,关闭MySQL进程。

2019-01-02 12:26:52 123

原创 AIO操作代码

#include&lt;stdio.h&gt;#include&lt;sys/socket.h&gt;#include&lt;netinet/in.h&gt;#include&lt;arpa/inet.h&gt;#include&lt;assert.h&gt;#include&lt;unistd.h&gt;#include&lt;stdlib.h&gt;#include&lt

2018-09-27 16:45:42 63

原创 在CentOS中下载并安装python3 笔记

在CentOS中下载并安装python31.安装必要的依赖工具 yum -y install net-tools yum -y install wget //安装下载工具,可以直接在网页中下载资源2.安装相关的依赖包yum install zlib-devel bzip2-devel openssl-devel ncurses-devel ...

2018-09-27 13:17:08 182

qt项目--车辆管理.rar

结合MySQL与XML实现车辆管理系统

2021-03-13

apache-storm-1.1.0.tar.gz

搭建大数据集群平台所需要的安装包之一,有需要的朋友可以来下载

2018-09-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除