#include <sys/uio.h>
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
struct iovec {
void *iov_base; /* Starting address */
size_t iov_len; /* Number of bytes to transfer */
};
The readv() system call reads iovcnt buffers from the file associated with the file descriptor fd into the buffers described by iov (“scatter input”).
The writev() system call writes iovcnt buffers of data described by iov to the file associated with the file descriptor fd (“gather output”).
#include <unistd.h>
#include <sys/uio.h>
#include <stdio.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
ssize_t iSize;
char acBuf1[9];
char acBuf2[9];
struct iovec iov[2];
int iFd1 = open(argv[1], O_RDONLY);
int iFd2 = open(argv[2], O_RDONLY);
int iFd3 = open(argv[3], O_WRONLY);
iSize = read(iFd1, acBuf1, sizeof(acBuf1));
iSize = read(iFd2, acBuf2, sizeof(acBuf2));
iov[0].iov_base = acBuf1;
iov[0].iov_len = sizeof(acBuf1);
iov[1].iov_base = acBuf2;
iov[1].iov_len = sizeof(acBuf2);
iSize = writev(iFd3, iov, 2);
close(iFd1);
close(iFd2);
close(iFd3);
return 0;
}
建立3个文件(test1, test2, test3)
test1写入12345
test2写入asdfghi
test3为空
运行
./a.out test1 test2 test3
GitHub markdown syntax.
Heads up!We love
open source.
User, Organization, and Project Pages
name: mdgsf
age: 25
cellphone: 111111111
You’ll find this post in your _posts
directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve
, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the _posts
directory that follows the convention YYYY-MM-DD-name-of-post.ext
and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
GitHub Flavored Markdown is supported.
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
Check out the Jekyll docs for more info on how to get the most out of Jekyll. File all bugs/feature requests at Jekyll’s GitHub repo. If you have questions, you can ask them on Jekyll’s dedicated Help repository.
bower.json
(it’s purely placebo right now, but it’s good habit) and package.json
.grunt
and commit the changes. This compiles the SCSS to CSS so we can do basic analysis on the number of selectors, file size, etc.