file(GLOB GLOG_LIBRARIES /usr/lib/x86_64-linux-gnu/libglog.so)
target_link_libraries(main ${GLOG_LIBRARIES})
#include <iostream>
#include <string>
#include <glog/logging.h>
#include <unistd.h>
using namespace std;
int main(int argc, char **argv) {
google::InitGoogleLogging(argv[0]);
FLAGS_log_dir = "/data/learn_test/";
FLAGS_alsologtostderr = 1;
int i = 0;
while(true) {
i++;
LOG(INFO)<<1<<2<<"%d"<<2<<endl;
sleep(1);
}
}
#include <iostream>
#include <string>
#include <glog/logging.h>
#include <unistd.h>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <sstream>
using namespace std;
vector<int> p;
int main(int argc, char **argv){
google::InitGoogleLogging("test");
FLAGS_alsologtostderr = 1;
FLAGS_log_dir = "./";
std::string file = "./1.txt";
std::ifstream s(file);
std::string data;
while(getline(s, data)) {
std::string key;
std::size_t pos = data.find('=');
key = data.substr(0, pos);
key.erase(std::remove(key.begin(), key.end(), ' '), key.end());
LOG(INFO)<<key<<endl;
string value;
value = data.substr(pos+1);
value.erase(std::remove(value.begin(), value.end(), ' '), value.end());
if(key == "j") {
istringstream sss(value);
string temp;
while (getline(sss,temp,',')){
int num = stoi(temp);
p.push_back(num);
}
LOG(INFO)<<p[0]<<endl;
LOG(INFO)<<p[1]<<endl;
LOG(INFO)<<p[2]<<endl;
}
else{
LOG(INFO)<<value<<endl;
}
}
}