Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mytests
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songxinkai
mytests
Commits
5008fb2e
Commit
5008fb2e
authored
Nov 30, 2019
by
songxinkai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~
parent
5ba605c7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
14 deletions
+54
-14
c++/file/binary_read_write/read_bin_edge.cpp
+20
-0
c++/file/binary_read_write/write_binary.py
+10
-0
c++/map/main.cpp
+8
-0
c++/string/main1.cpp
+16
-14
No files found.
c++/file/binary_read_write/read_bin_edge.cpp
0 → 100644
View file @
5008fb2e
#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
;
}
c++/file/binary_read_write/write_binary.py
0 → 100755
View file @
5008fb2e
#!/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
()
c++/map/main.cpp
0 → 100644
View file @
5008fb2e
#include <iostream>
#include <map>
using
namespace
std
;
int
main
(){
return
0
;
}
c++/string/main1.cpp
View file @
5008fb2e
...
...
@@ -7,19 +7,21 @@ using namespace std;
int
main
(){
string
a
(
"1.bin.finish"
);
string
b
(
".finish"
);
string
c
(
"1.bin"
);
vector
<
string
>
v
;
v
.
push_back
(
a
);
v
.
push_back
(
b
);
v
.
push_back
(
c
);
cout
<<
string
::
npos
<<
endl
;
cout
<<
a
.
find
(
b
)
<<
endl
;
if
(
string
::
npos
!=
a
.
find
(
b
)){
cout
<<
a
<<
" find "
<<
b
<<
", at "
<<
a
.
find
(
b
)
<<
endl
;
cout
<<
a
.
substr
(
0
,
a
.
find
(
b
))
<<
" + "
<<
b
<<
" = "
<<
a
<<
endl
;
}
vector
<
string
>::
iterator
it_str
=
find
(
v
.
begin
(),
v
.
end
(),
c
);
cout
<<
(
it_str
==
v
.
end
())
<<
", "
<<
*
it_str
<<
endl
;
string
b
(
".fisnish"
);
cout
<<
(
string
::
npos
==
a
.
find
(
b
))
<<
endl
;
cout
<<
(
string
::
npos
==
a
.
find
(
"."
))
<<
endl
;
// string c("1.bin");
// vector<string> v;
// v.push_back(a);
// v.push_back(b);
// v.push_back(c);
// cout << string::npos << endl;
// cout << a.find(b) << endl;
// if (string::npos != a.find(b)){
// cout << a << " find " << b << ", at " << a.find(b) << endl;
// cout << a.substr(0, a.find(b)) << " + " << b << " = " << a << endl;
// }
// vector<string>::iterator it_str = find(v.begin(), v.end(), c);
// cout << (it_str == v.end()) << ", " << *it_str << endl;
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment