当前位置: 首页 > news >正文

深圳怎么做网站微信营销推广方案

深圳怎么做网站,微信营销推广方案,有了网站域名如何做网站,网站怎么做商桥1.引言 为了学习linux系统下的app开发&#xff0c;记载了学习文件编程的笔记 2.open函数 功能 打开一个文件 头文件 #include<sys/stat.h> #include<fcntl.h> 函数形式 int open(const char* pathname, int flags, mode_t mode); 返回值 如果调用成功&#xff0c…

1.引言

为了学习linux系统下的app开发,记载了学习文件编程的笔记

2.open函数

功能

        打开一个文件

头文件

        #include<sys/stat.h> #include<fcntl.h>

函数形式

         int open(const char* pathname, int flags, mode_t mode);

返回值

        如果调用成功,则返回文件描述符号,标识文件资源,后续会使用。 如果调用出错,则会返回-1

参数

        pathname:打开的文件名(含路径)。

        flags: 文件访问模式的bit mask。

        mode: 文件权限模式

3. 使用案例

copy文件的案例

文件如下,名字:copy_file.c

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h> 
#include <errno.h>#define BUFFER_SIZE 1024 int main(int argc,char *argv[]) 
{ int from_fd,to_fd; int bytes_read,bytes_write; char buffer[BUFFER_SIZE]; char *ptr; //参数防卫,命令选项必须输入3个参数if(argc!=3) { fprintf(stderr,"Usage:%s fromfile tofile/n/a",argv[0]); exit(1); } //以只读的方式打开第一个参数(文件路径)if((from_fd=open(argv[1],O_RDONLY))==-1) { //打开失败fprintf(stderr,"Open %s Error:%s/n",argv[1],strerror(errno)); exit(1); } // Constant Octal	value	Permission	bit
// S_ISUID	04000	Set-user-ID
// S_ISGID	02000	Set-group-ID
// S_ISVTX	01000	Sticky
// S_IRUSR	0400	User-read
// S_IWUSR	0200	User-write
// S_IXUSR	0100	User-execute
// S_IRGRP	040	    Group-read
// S_IWGRP	020	    Group-write
// S_IXGRP	010	    Group-execute
// S_IROTH	04	    Other-read
// S_IWOTH	02	    Other-write
// S_IXOTH	01	    Other-execute// Flag         describtion
// O_RDONLY     Open for reading only v3
// O_WRONLY     Open for writing only v3
// O_RDWR       Open for reading and writing v3
// O_CLOEXEC    Set the close-on-exec flag (since Linux 2.6.23) v4
// O_CREAT      Create file if it doesn’t already exist v3
// O_DIRECT     File I/O bypasses buffer cache
// O_DIRECTORY  Fail if pathname is not a directory v4
// O_EXCL       With O_CREAT: create file exclusively v3
// O_LARGEFILE  Used on 32-bit systems to open large files
// O_NOATIME    Don’t update file last access time on read() (since Linux 2.6.8)
// O_NOCTTY     Don’t let pathname become the controlling terminal v3
// O_NOFOLLOW   Don’t dereference symbolic links v4
// O_TRUNC      Truncate existing file to zero length v3
// O_APPEND     Writes are always appended to end of file v3
// O_ASYNC      Generate a signal when I/O is possible
// O_DSYNC      Provide synchronized I/O data integrity (since Linux 2.6.33) v3
// O_NONBLOCK   Open in nonblocking mode v3
// O_SYNC       Make file writes synchronousif((to_fd=open(argv[2],O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR))==-1) { fprintf(stderr,"Open %s Error:%s/n",argv[2],strerror(errno)); exit(1); } while(bytes_read=read(from_fd, buffer, BUFFER_SIZE)) { if((bytes_read==-1)&&(errno!=EINTR)) {break;}    else if(bytes_read > 0) { ptr = buffer; while(bytes_write=write(to_fd,ptr,bytes_read)) { if((bytes_write==-1)&&(errno!=EINTR))break; else if(bytes_write==bytes_read)break; else if(bytes_write>0) { ptr+=bytes_write; bytes_read-=bytes_write; } } if(bytes_write==-1)break; } } close(from_fd); close(to_fd); exit(0); 
} 

编译用Makefile

TARGET := app
#src file
SRC := copy_file.call:$(TARGET)@echo "make successfull"$(TARGET): $(SRC)@echo $(SRC)gcc  $^ -I. -o $@clean:rm $(TARGET).PHONY:all,clean

ubuntu系统下使用gcc编译通过,运行实例如下

终端命令:./app copy_file.c a.c
结果展示命令: ll
total 41
drwxrwxrwx 1 root root  4096 May 25 23:05 ./
drwxrwxrwx 1 root root     0 Mar  8 21:31 ../
-rwxrwxrwx 1 root root  3165 May 25 23:05 a.c*    --->(复制成功的新文件)
-rwxrwxrwx 1 root root 17056 May 25 23:04 app*
-rwxrwxrwx 1 root root  3165 May 25 23:04 copy_file.c*

http://www.khdw.cn/news/20606.html

相关文章:

  • 邳州网站建设广东最新疫情
  • 自家房子做民宿的网站市场营销互联网营销
  • 济源网站制作最好的免费推广平台
  • 曲靖手机网站建设昆明抖音推广
  • 佘山网站建设百度提交网址入口
  • 网站制作怎么创业河南网站排名
  • 做网站开视频网站游戏推广代理加盟
  • 个人网站建设培训竞价排名规则
  • 房山营销型网站建设哈尔滨最新消息
  • 国外做游戏的视频网站有哪些视频seo优化教程
  • 宜昌平台网站建设近10天的时事新闻
  • 做网站那里做可靠晨阳seo顾问
  • 化妆品网页设计论文seo优化seo外包
  • 注册公司费用是多少网站seo内容优化
  • 朔州推广型网站建设网络营销措施有哪些
  • 营销培训课程有哪些旺道seo系统
  • 怎么做免费的网站链接2022年新闻大事
  • wordpress 怎样写函数长沙企业seo服务
  • 怎样做网站呢长春网站制作计划
  • 网站有后台更新不了培训网站推广
  • 香港网站速度慢广州百度关键词搜索
  • 做网站生意不赚钱怎样推广品牌
  • 深圳做网站(官网)seo站长工具是什么
  • 什么网站可以买世界杯seo提升排名
  • 武汉防役新动态宁波seo外包服务
  • 企业为什么做网站优化推广网站流量统计系统
  • 中山模板自助建站百度收录量查询
  • 网站建设个体营业执照百度大数据
  • css网站模板企业策划方案怎么做
  • 新媒体做图网站创建自己的网站怎么弄