当前位置: 技术问答>linux和unix
mmap()函数使用问题
来源: 互联网 发布时间:2016-10-28
本文导语: /* * mmcat.c - Implement the cat command using memory maps */ #include #include #include #include #include #include #include void err_quit(char *msg); int main(int argc, char *argv[]) { int fdin; char ...
/*
* mmcat.c - Implement the cat command using memory maps
*/
#include
#include
#include
#include
#include
#include
#include
void err_quit(char *msg);
int main(int argc, char *argv[])
{
int fdin;
char *src;
int len;
struct stat statbuf;
/* Make sure we were called properly */
if (argc != 2)
{
fprintf(stderr, "usage: mmcat filename");
exit(EXIT_FAILURE);
}
/* Open the input file and stdout */
if ((fdin = open(argv[1], "r"))
* mmcat.c - Implement the cat command using memory maps
*/
#include
#include
#include
#include
#include
#include
#include
void err_quit(char *msg);
int main(int argc, char *argv[])
{
int fdin;
char *src;
int len;
struct stat statbuf;
/* Make sure we were called properly */
if (argc != 2)
{
fprintf(stderr, "usage: mmcat filename");
exit(EXIT_FAILURE);
}
/* Open the input file and stdout */
if ((fdin = open(argv[1], "r"))