我想指定一个偏移量,然后读取文件的字节
offset = 5
read(5)
Run Code Online (Sandbox Code Playgroud)
然后阅读下一个6-10等我读到了关于搜索但我无法理解它是如何工作的,这些例子不够描述.
seek(offset,1) 什么回报?
谢谢
我有以下程序
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 int check_authentication(char *password){
6 char password_buffer[16];
7 int auth_flag =0;
8
9
10 strcpy(password_buffer, password);
11
12 if(strcmp(password_buffer, "brillig" ) == 0 )
13 auth_flag = 1;
14 if(strcmp(password_buffer, "outgrabe") == 0)
15 auth_flag = 1;
16
17 return auth_flag;
18 }
19
20 int main(int argc, char *argv[]){
21 if (argc<2){
22 printf("Usage: %s <password>\n", argv[0]);
23 exit(0);
24 }
25
26 if(check_authentication(argv[1])){
27 printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
28 printf(" …Run Code Online (Sandbox Code Playgroud) 我有几个安装了 filebeat 的 Web 服务器,并且我希望每个主机有多个索引。
我当前的配置如下
input {
beats {
ports => 1337
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}"}
}
geoip {
source => "clientip"
}
}
output {
elasticsearch {
if [beat][hostname] == "luna"
{
hosts => "10.0.1.1:9200"
manage_template => true
index => "lunaindex-%{+YYYY.MM.dd}"
document_type => "apache"
}
}
}
Run Code Online (Sandbox Code Playgroud)
然而上面的conf结果是
给定的配置无效。原因:第 22 行第 6 列(字节 346)需要 #、=> 之一
这是 if 语句发生的地方。有什么帮助吗?
我希望将以上内容采用嵌套格式
if [beat][hostname] == "lina"
{
index = lina
}
else …Run Code Online (Sandbox Code Playgroud)