Commit 5008fb2e by songxinkai

~

parent 5ba605c7
#include <iostream>
#include <fstream>
using namespace std;
int main(){
//ifstream in("/home/songxinkai/bin_edges/edges.reddit.fea16.bin", ios::in | ios::binary);
//ifstream in("/home/songxinkai/GraphData_1/bin_edges/edges.enzymes.cachesize_10MB_lrd_16wayset.fea_64.bin", ios::in | ios::binary);
ifstream in("a.bin", ios::in | ios::binary);
int* data = new int[4]; // 0: dst_vid, 1: src_vid, 2: is_cache_miss, 3: is_last_src
while(!in.eof()){
in.read((char*)data, sizeof(int)*4);
//if (data[0] % 1000 != 0) continue;
for (int j = 0; j < 4; ++j){
cout << data[j] << ", ";
}
cout << endl;
}
return 0;
}
#!/usr/bin/python
import struct
f = open("a.bin", "ab")
f.write(struct.pack('i', 10))
f.write(struct.pack('i', 10))
f.write(struct.pack('i', 10))
f.write(struct.pack('i', 10))
f.write(struct.pack('i', 10))
f.close()
#include <iostream>
#include <map>
using namespace std;
int main(){
return 0;
}
...@@ -7,19 +7,21 @@ using namespace std; ...@@ -7,19 +7,21 @@ using namespace std;
int main(){ int main(){
string a("1.bin.finish"); string a("1.bin.finish");
string b(".finish"); string b(".fisnish");
string c("1.bin"); cout << (string::npos == a.find(b)) << endl;
vector<string> v; cout << (string::npos == a.find(".")) << endl;
v.push_back(a); // string c("1.bin");
v.push_back(b); // vector<string> v;
v.push_back(c); // v.push_back(a);
cout << string::npos << endl; // v.push_back(b);
cout << a.find(b) << endl; // v.push_back(c);
if (string::npos != a.find(b)){ // cout << string::npos << endl;
cout << a << " find " << b << ", at " << a.find(b) << endl; // cout << a.find(b) << endl;
cout << a.substr(0, a.find(b)) << " + " << b << " = " << a << endl; // if (string::npos != a.find(b)){
} // cout << a << " find " << b << ", at " << a.find(b) << endl;
vector<string>::iterator it_str = find(v.begin(), v.end(), c); // cout << a.substr(0, a.find(b)) << " + " << b << " = " << a << endl;
cout << (it_str == v.end()) << ", " << *it_str << endl; // }
// vector<string>::iterator it_str = find(v.begin(), v.end(), c);
// cout << (it_str == v.end()) << ", " << *it_str << endl;
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment