Linux 1.文件编程(open、creat、write、read、lseek)

文件的打开及创建(open和creat)

open函数的头文件、函数原型

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

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

int creat(const char *pathname, mode_t mode);

pathname:待打开/创建文件的POSIX路径名(如/home/user/a.cpp)省略则代表当前路径。

flags:用于指定文件的打开/创建模式。

O_RDONLY 只读模式
O_WRONLY 只写模式
O_RDWR 读写模式

打开/创建文件时,至少得使用上述三个常量中的一个。以下常量是选用的:

O_APPEND 每次写操作都写入文件的末尾
O_CREAT 如果指定文件不存在,则创建这个文件
O_EXCL 如果同时指定了OCREAT 而文件已经存在,则打开文件失败(返回值为-1)。
O_TRUNC 如果文件存在,并且以只写/读写方式打开,则清空文件全部内容(即将其长度截短为0)
O_NOCTTY 如果路径名指向终端设备,不要把这个设备用作控制终端。
O_NONBLOCK 如果路径名指向FIFO/块文件/字符文件,则把文件的打开和后继I/O

mode:仅当创建新文件时(即用了 O_CREAT 时)才使用,用于指定文件的访问权限位。

是权限来的,我们可以通过 ls -l 指令查看文件 -rwx ,-(普通文件)、r(可读)、w(可写)、x(可执行)。

fd = open("./文件名",o_RDWR|O_CREAT,0600);

0600中的 6 是 4+2(可读可写)

creat函数的头文件、函数原型

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

int creat(const char *pathname, mode_t mode);

pathname:待打开/创建文件的POSIX路径名(如/home/user/a.cpp)省略则代表当前路径。

mode

宏表示   数字
S_IRUSR  4   可读
S_IWUSR  2   可写
S_IXUSR  1   可执行
S_IRWXU  7   可读、可写、可执行

open函数返回值

成功:新打开的文件描述符
失败:-1
open返回的文件描述符一定是最小的而且没有被使用的

creat函数返回值

成功:返回新的文件描述符号。fd=creat();
失败:返回-1, 并把错误代码设给errno.

open函数打开文件

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

int main()
{
	int fd;
	
	fd=open("./file",O_RDWR);
	
	printf("fd=%d\n",fd);
	
	if(fd>0)
	{
		printf("open file successfully!\n");
	}
	else
	{
		printf("fail to open file!\n");
	}
	
	return 0;	
}

open函数打开文件配合O_CREAT创建文件

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

int main()
{
	int fd;
	
	fd=open("./file",O_RDWR);
	
	if(fd==-1)
	{
		printf("No such file\n");
		
		fd=open("./file",O_RDWR|O_CREAT,0600);
		if(fd>0)
		{
			printf("File created successfully\n");
		}
	}
	return 0;
}

open函数打开文件配合O_EXCL同时指定了OCREAT,而文件已经存在,则打开文件失败(返回值为-1)。

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

int main()
{
        int fd;

        fd=open("./file",O_RDWR|O_CREAT|O_EXCL,0600);

        if(fd==-1)
        {
                printf("File already exist\n");
        }
        return 0;
}

运行结果:

文件不存在,则创建文件

在这里插入图片描述

文件存在,则打开文件失败(返回值为fd=-1)

在这里插入图片描述

O_APPEND每次写时都加到文件的尾端

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
        int fd=0;
        char* buf="chenlichen hen shuai!";

        fd=open("./file",O_RDWR|O_APPEND);

        if(fd==-1)
        {
                printf("No such file\n");

                fd=open("./file",O_RDWR|O_CREAT,0600);

                if(fd>0)
                {
                        printf("File created successfully\n");
                        printf("fd=%d\n",fd);
                }
        }

        write(fd,buf,strlen(buf));

        close(fd);

        return 0;
}

运行结果:

原文件

在这里插入图片描述

将 chenlichen hen shuai! 加至文件末尾,另起一行。

在这里插入图片描述

如果没有O_APPEDN 则写入内容会按位覆盖原本有的部分内容。

O_TRUNC 属性去打开文件时,如果这个文件中本来是有内容的,而且为只读或者只写成功打开,则将其长度截短为0(清零!)

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
        int fd=0;
        char* buf="Yinyuer is a pretty girl!";

        fd=open("./file",O_RDWR|O_TRUNC);

        if(fd==-1)
        {
                printf("No such file\n");

                fd=open("./file",O_RDWR|O_CREAT,0600);

                if(fd>0)
                {
                        printf("File created successfully\n");
                        printf("fd=%d\n",fd);
                }
        }

        write(fd,buf,strlen(buf));

        close(fd);

        return 0;
}

运行结果:

运行前 file 文件内容

在这里插入图片描述

运行后 file 文件内容

在这里插入图片描述

creat函数创建文件

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

int main()
{
        int fd;

        fd=creat("/home/yinyuer/file",S_IRWXU);

        return 0;
}

运行结果:

运行前,工作目录 /home/yinyuer/ 下的全部文件

在这里插入图片描述

运行后,工作目录 /home/yinyuer/ 下的全部文件,以及 file 权限,可读可写可执行。

在这里插入图片描述

文件的写入(write)

write函数的头文件、函数原型

#include <unistd.h>

ssize_t write(int fd, const void *buf, size_t count);

fd:文件描述符;

buf:指定的缓冲区,即指针,指向一段内存单元;

count:要写入文件指定的字节数;

write函数的返回值

成功:写入文档的字节数
失败:-1
write函数把buf中count写入文件描述符handle所指的文档,成功时返回写的字节数,错误时返回-1

write函数写入文件

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
        int fd=0;
        char* buf="chenlichen hen shuai!";

        fd=open("./file",O_RDWR);

        if(fd==-1)
        {
                printf("No such file\n");

                fd=open("./file",O_RDWR|O_CREAT,0600);

                if(fd>0)
                {
                        printf("File created successfully\n");
                        printf("fd=%d\n",fd);
                }
        }

        write(fd,buf,strlen(buf));

        close(fd);

        return 0;
}

注意

计算buf中字符个数时,用strlen()函数

运行结果:

在这里插入图片描述

vi file

文件的读取(read)

read函数的头文件、函数原型

#include <unistd.h>

ssize_t read(int fd, void *buf, size_t count);

fd:文件描述符;

buf:指定的缓冲区,即指针,指向一段内存单元;

count:要写入文件指定的字节数;

read函数的返回值

成功:返回读取的字节数
出错:返回-1并设置errno
如果在调read之前已到达文件末尾,则这次read返回0

read函数读取文件

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
        int fd=0;
        char* buf="chenlichen hen shuai!";

        fd=open("./file",O_RDWR);

        if(fd==-1)
        {
                printf("No such file\n");

                fd=open("./file",O_RDWR|O_CREAT,0600);

                if(fd>0)
                {
                        printf("File created successfully\n");
                        printf("fd=%d\n",fd);
                }
        }

        int n_write=write(fd,buf,strlen(buf));
        if(n_write!=-1)
        {
                printf("Writed %d bytes to file\n",n_write);
        }

        close(fd);
        fd=open("./file",O_RDWR);

        char* readBuf=NULL;
        readBuf=(char*)malloc(sizeof(char)*n_write);

        int n_read=read(fd,readBuf,n_write);
        if(n_read!=-1)
        {
                printf("read %d bytes from file:%s\n",n_read,readBuf);
        }

        close(fd);
        return 0;
}

注意

我们对文件打开之后并且写入内容,当我们读取文件内容时,有两种方法:

  1. 先关闭文件 close(fd),再重新打开文件 open(“./file”,O_RDWR) 读取文件。因为如果你不关闭文件,光标是在文件末端,是读取不到数据的。

  2. 使用 lseek() 函数,lseek(fd,0,SEEK_SET) 把光标重新拉回文件头。

运行结果:

在这里插入图片描述

文件光标的移动就、计算文件大小(lseek)

lseek函数的头文件、函数原型

#include <sys/types.h>
#include <unistd.h>

off_t lseek(int fd, off_t offset, int whence);

fd:文件描述符;

offset:向后的偏移值,整数往后,负数往前

whence

SEEK_SET 参数 offset 即为新的读写位置.
SEEK_CUR 以目前的读写位置往后增加 offset 个位移量.
SEEK_END 将读写位置指向文件尾后再增加 offset 个位移量.当 whence 值为 SEEK_CURSEEK_END, 参数 offet 允许负值的出现.

下列是教特别的使用方式:

  1. 欲将读写位置移到文件开头时:lseek(int fildes,0, SEEK_SET);

  2. 欲将读写位置移到文件尾时:lseek(int fildes,0, SEEK_END);

  3. 想要取得目前文件位置时:lseek(int fildes,0, SEEK_CUR);

lseek函数的返回值

成功:返回目前的读写位置, 也就是距离文件开头多少个字节.
失败:则返回-1, errno 会存放错误代码.

lseek函数将光标拉回文件开头

我们之前打开文件并且写入内容,我们不用关闭再打开文件再读取,我们直接用lseek让光标移到头就可以了。

#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
        int fd=0;
        char* buf="chenlichen hen shuai!";

        fd=open("./file",O_RDWR);

        if(fd==-1)
        {
                printf("No such file\n");

                fd=open("./file",O_RDWR|O_CREAT,0600);

                if(fd>0)
                {
                        printf("File created successfully\n");
                        printf("fd=%d\n",fd);
                }
        }

        int n_write=write(fd,buf,strlen(buf));
        if(n_write!=-1)
        {
                printf("Writed %d bytes to file\n",n_write);
        }

//      close(fd);
//      fd=open("./file",O_RDWR);

        lseek(fd,0,SEEK_SET);

        char* readBuf=NULL;
        readBuf=(char*)malloc(sizeof(char)*n_write);

        int n_read=read(fd,readBuf,n_write);
        if(n_read!=-1)
        {
                printf("read %d bytes from file:%s\n",n_read,readBuf);
        }

        close(fd);
        return 0;
}

lseek函数计算文件的大小

通过 lseek 的返回值来计算内容大小。

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
        int fd=0;
        char* buf="chenlichen hen shuai!";

        fd=open("./file",O_RDWR);

        int fileSize=lseek(fd,0,SEEK_END);
        printf("file 's size is %d\n",fileSize);

        close(fd);
        return 0;
}

运行结果:

在这里插入图片描述

用lseek构建空洞文件

  1. 空洞文件就是这个文件中有一段是空的。

  2. 普通文件中间是不能有空的,因为我们write时文件指针是依次从前到后去移动的,不可能绕过前面直接到后面。

  3. 我们打开一个文件后,用lseek往后跳过一段,再write写入一段,就会构成一个空洞文件。

  4. 空洞文件方法对多线程共同操作文件是及其有用的。有时候我们创建一个很大的文件,如果从头开始依次构建时间很长。有一种思路就是将文件分为多段,然后多线程来操作每个线程负责其中一段的写入。

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

/*
 * ./lseek_2 1.txt
 * argc    = 2
 * argv[0] = "./lseek_2"
 * argv[1] = "1.txt"
 * ...
 */

int main(int argc,char **argv)
{
	int i = 0;
	int fd = 0;
	int len = 0;
	char *read_Buf = "hello_word!";

	if(argc < 2)
	{
		printf("Usage:%s <file> <message> ...\n",argv[0]);

		return -1;
	}

	fd = open(argv[1],O_RDWR | O_CREAT, 0666);
	
	if(fd < 0)
	{
		printf("Can not open %s!\n",argv[1]);
		printf("errno = %d\n",errno);
		printf("%s\n",strerror(errno));

		return -1;
	}
	
	lseek(fd,10,SEEK_SET);

	write(fd,read_Buf,strlen(read_Buf));

	close(fd);

	return 0;
}

运行结果:

偏移值 : 10 + hello_word! : 11 = 21

在这里插入图片描述

在这里插入图片描述

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目 录 译者序 译者简介 前言 第1章 UNIX基础知识 1 1.1 引言 1 1.2 登录 1 1.2.1 登录名 1 1.2.2 shell 1 1.3 文件和目录 2 1.3.1 文件系统 2 1.3.2 文件名 2 1.3.3 路径名 2 1.3.4 工作目录 4 1.3.5 起始目录 4 1.4 输入和输出 5 1.4.1 文件描述符 5 1.4.2 标准输入、标准输出和标准 出错 5 1.4.3 不用缓存的I/O 5 1.4.4 标准I/O 6 1.5 程序和进程 7 1.5.1 程序 7 1.5.2 进程和进程ID 7 1.5.3 进程控制 7 1.6 ANSI C 9 1.6.1 函数原型 9 1.6.2 类属指针 9 1.6.3 原始系统数据类型 10 1.7 出错处理 10 1.8 用户标识 11 1.8.1 用户ID 11 1.8.2 组ID 12 1.8.3 添加组ID 12 1.9 信号 12 1.10 UNIX时间值 14 1.11 系统调用和库函数 14 1.12 小结 16 习题 16 第2章 UNIX标准化及实现 17 2.1 引言 17 2.2 UNIX标准化 17 2.2.1 ANSI C 17 2.2.2 IEEE POSIX 18 2.2.3 X/Open XPG3 19 2.2.4 FIPS 19 2.3 UNIX实现 19 2.3.1 SVR4 20 2.3.2 4.3+BSD 20 2.4 标准和实现的关系 21 2.5 限制 21 2.5.1 ANSI C限制 22 2.5.2 POSIX限制 22 2.5.3 XPG3限制 24 2.5.4 sysconf、pathconf 和fpathconf 函数 24 2.5.5 FIPS 151-1要求 28 2.5.6 限制总结 28 2.5.7 未确定的运行时间限制 29 2.6 功能测试宏 32 2.7 基本系统数据类型 32 2.8 标准之间的冲突 33 2.9 小结 34 习题 34 第3章 文件I/O 35 3.1 引言 35 3.2 文件描述符 35 3.3 open函数 35 3.4 creat函数 37 3.5 close函数 37 3.6 lseek函数 38 3.7 read函数 40 3.8 write函数 41 3.9 I/O的效率 41 3.10 文件共享 42 3.11 原子操作 45 3.11.1 添加至一个文件 45 3.11.2 创建一个文件 45 3.12 dup和dup2函数 46 3.13 fcntl函数 47 3.14 ioctl函数 50 3.15 /dev/fd 51 3.16 小结 52 习题 52 第4章 文件和目录 54 4.1 引言 54 4.2 stat, fstat和lstat函数 54 4.3 文件类型 55 4.4 设置-用户-ID和设置-组-ID 57 4.5 文件存取许可权 58 4.6 新文件和目录的所有权 60 4.7 access函数 60 4.8 umask函数 62 4.9 chmod和fchmod函数 63 4.10 粘住位 65 4.11 chown, fchown和 lchown函数 66 4.12 文件长度 67 4.13 文件截短 68 4.14 文件系统 69 4.15 link, unlink, remove和rename 函数 71 4.16 符号连接 73 4.17 symlink 和readlink函数 76 4.18 文件的时间 76 4.19 utime函数 78 4.20 mkdir和rmdir函数 79 4.21 读目录 80 4.22 chdir, fchdir和getcwd函数 84 4.23 特殊设备文件 86 4.24 sync和fsync函数 87 4.25 文件存取许可权位小结 88 4.26 小结 89 习题 89 第5章 标准I/O库 91 5.1 引言 91 5.2 流和FILE对象 91 5.3 标准输入、标准输出和标准出错 91 5.4 缓存 91 5.5 打开流 94 5.6 读和写流 96 5.6.1 输入函数 96 5.6.2 输出函数 97 5.7 每次一行I/O 98 5.8 标准I/O的效率 99 5.9 二进制I/O 100 5.10 定位流 102 5.11 格式化I/O 103 5.11.1 格式化输出 103 5.11.2 格式化输入 103 5.12 实现细节 104 5.13 临时文件 105 5.14 标准I/O的替代软件 108 5.15 小结 108 习题 108 第6章 系统数据文件和信息 110 6.1 引言 110 6.2 口令文件 110 6.3 阴影口令 112 6.4 组文件 113 6.5 添加组ID 114 6.6 其他数据文件 115 6.7 登录会计 116 6.8 系统标识 116 6.9 时间和日期例程 117 6.10 小结 121 习题 121 第7章 UNIX进程的环境 122 7.1 引言 122 7.2 main 函数 122 7.3 进程终止 122 7.3.1 exit和_exit函数 122 7.3.2 atexit函数 124 7.4 命令行参数 125 7.5 环境表 126 7.6 C程序的存储空间布局 126 7.7 共享库 127 7.8 存储器分配 128 7.9 环境变量 130 7.10 setjmp 和longjmp函数 132 7.10.1 自动、寄存器和易失变量 134 7.10.2 自动变量的潜在问题 136 7.11 getrlimit 和setrlimit函数 136 7.12 小结 139 习题 140 第8章 进程控制 141 8.1 引言 141 8.2 进程标识 141 8.3 fork函数 142 8.4 vfork 函数 145 8.5 exit函数 147 8.6 wait和waitpid函数 148 8.7 wait3和wait4函数 152 8.8 竞态条件 153 8.9 exec函数 156 8.10 更改用户ID和组ID 160 8.10.1 setreuid 和setregid函数 162 8.10.2 seteuid和 setegid函数 163 8.10.3 组ID 163 8.11 解释器文件 164 8.12 system函数 167 8.13 进程会计 171 8.14 用户标识 175 8.15 进程时间 176 8.16 小结 178 习题 178 第9章 进程关系 180 9.1 引言 180 9.2 终端登录 180 9.2.1 4.3+BSD终端登录 180 9.2.2 SVR4终端登录 182 9.3 网络登录 182 9.3.1 4.3+BSD网络登录 182 9.3.2 SVR4网络登录 183 9.4 进程组 183 9.5 对话期 184 9.6 控制终端 185 9.7 tcgetpgrp 和tcsetpgrp函数 187 9.8 作业控制 187 9.9 shell执行程序 189 9.10 孤儿进程组 193 9.11 4.3+BSD实现 195 9.12 小结 197 习题 197 第10章 信号 198 10.1 引言 198 10.2 信号的概念 198 10.3 signal函数 203 10.3.1 程序起动 205 10.3.2 进程创建 206 10.4 不可靠的信号 206 10.5 中断的系统调用 207 10.6 可再入函数 209 10.7 SIGCLD语义 211 10.8 可靠信号术语和语义 213 10.9 kill和raise函数 213 10.10 alarm和pause函数 214 10.11 信号集 219 10.12 sigprocmask 函数 220 10.13 sigpending函数 222 10.14 sigaction函数 223 10.15 sigsetjmp 和siglongjmp函数 226 10.16 sigsuspend函数 229 10.17 abort函数 234 10.18 system函数 235 10.19 sleep函数 240 10.20 作业控制信号 241 10.21 其他特征 243 10.21.1 信号名字 243 10.21.2 SVR4信号处理程序的附 加参数 244 10.21.3 4.3+BSD信号处理程序的附 加参数 244 10.22 小结 244 习题 244 第11章 终端I/O 246 11.1 引言 246 11.2 综述 246 11.3 特殊输入字符 250 11.4 获得和设置终端属性 254 11.5 终端选择标志 254 11.6 stty命令 258 11.7 波特率函数 259 11.8 行控制函数 260 11.9 终端标识 260 11.10 规范方式 263 11.11 非规范方式 266 11.12 终端的窗口大小 270 11.13 termcap, terminfo和 curses 271 11.14 小结 272 习题 272 第12章 高级I/O 273 12.1 引言 273 12.2 非阻塞I/O 273 12.3 记录锁 275 12.3.1 历史 276 12.3.2 fcntl记录锁 276 12.3.3 锁的隐含继承和释放 280 12.3.4 4.3+BSD的实现 281 12.3.5 建议性锁和强制性锁 284 12.4 流 288 12.4.1 流消息 289 12.4.2 putmsg和putpmsg函数 290 12.4.3 流ioctl操作 291 12.4.4 write至流设备 294 12.4.5 写方式 294 12.4.6 getmsg和getpmsg函数 294 12.4.7 读方式 295 12.5 I/O多路转接 296 12.5.1 select函数 298 12.5.2 poll函数 301 12.6 异步I/O 303 12.6.1 SVR4 303 12.6.2 4.3+BSD 303 12.7 readv和writev函数 304 12.8 readn和writen函数 306 12.9 存储映射I/O 307 12.10 小结 311 习题 311 第13章 精灵进程 312 13.1 引言 312 13.2 精灵进程的特征 312 13.3 编程规则 313 13.4 出错记录 314 13.4.1 SVR4流log驱动程序 315 13.4.2 4.3+BSD syslog设施 316 13.5 客户机-服务器模型 319 13.6 小结 319 习题 319 第14章 进程间通信 320 14.1 引言 320 14.2 管道 320 14.3 popen和pclose函数 325 14.4 协同进程 330 14.5 FIFO 333 14.6 系统V IPC 335 14.6.1 标识符和关键字 336 14.6.2 许可权结构 337 14.6.3 结构限制 337 14.6.4 优点和缺点 337 14.7 消息队列 338 14.8 信号量 342 14.9 共享存储 346 14.10 客户机-服务器属性 351 14.11 小结 353 习题 353 第15章 高级进程间通信 355 15.1 引言 355 15.2 流管道 355 15.3 传送文件描述符 358 15.3.1 SVR4 360 15.3.2 4.3BSD 361 15.3.3 4.3+BSD 364 15.4 open服务器第1版 366 15.5 客户机-服务器连接函数 371 15.5.1 SVR4 372 15.5.2 4.3+BSD 375 15.6 open服务器第2版 378 15.7 小结 385 习题 385 第16章 数据库函数库 386 16.1 引言 386 16.2 历史 386 16.3 函数库 386 16.4 实现概述 388 16.5 集中式或非集中式 390 16.6 并发 391 16.6.1 粗锁 391 16.6.2 细锁 391 16.7 源码 392 16.8 性能 409 16.8.1 单进程的结果 410 16.8.2 多进程的结果 410 16.9 小结 412 习题 412 第17章 与PostScript打印机通信 413 17.1 引言 413 17.2 PostScript通信机制 413 17.3 假脱机打印 415 17.4 源码 417 17.5 小结 434 习题 434 第18章 调制解调器拨号器 435 18.1 引言 435 18.2 历史 435 18.3 程序设计 436 18.4 数据文件 437 18.5 服务器设计 439 18.6 服务器源码 439 18.7 客户机设计 463 18.7.1 终端行规程 463 18.7.2 一个进程还是两个进程 464 18.8 客户机源码 465 18.9 小结 474 习题 474 第19章 伪终端 476 19.1 引言 476 19.2 概述 476 19.2.1 网络登录服务器 477 19.2.2 script程序 478 19.2.3 expect程序 479 19.2.4 运行协同进程 479 19.2.5 观看长时间运行程序的输出 479 19.3 打开伪终端设备 480 19.3.1 SVR4 481 19.3.2 4.3+BSD 482 19.4 pty_fork函数 484 19.5 pty程序 486 19.6 使用pty程序 489 19.6.1 utmp文件 489 19.6.2 作业控制交互 489 19.6.3 检查长时间运行程序的输出 491 19.6.4 script程序 491 19.6.5 运行协同进程 492 19.6.6 用非交互模式驱动交互式 程序 492 19.7 其他特性 494 19.7.1 打包模式 494 19.7.2 远程模式 494 19.7.3 窗口大小变化 495 19.7.4 信号发生 495 19.8 小结 495 习题 495 附录A 函数原型 497 附录B 其他源代码 512 附录C 习题答案 518 参考书目 536

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值