-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
49 lines (36 loc) · 948 Bytes
/
test.cpp
File metadata and controls
49 lines (36 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<iostream>
#include<fstream>
#include<cstring>
#include<vector>
using namespace std;
char *reader(const char *input){
char *cursor = (char*)input;
while(*cursor){
cout << *cursor << endl;
cout << "next token : "<<*(cursor+1)<<" current token : "<< *cursor<<endl;
cursor++;
}
return cursor;
}
void cmp(void){
const char* t= "abcdef";
const char* x = "abc12";
if(memcmp(t,x,3) == 0){
cout << "Partly correct."<<endl;
}
}
int main(int argc,char* argv[])
{
bool a = true;
cout <<"bool : "<<a<<endl;
//load file using string's method
ifstream ifs(argv[1]);
if(ifs.fail()){
cerr << "Error : Failed to open a file. "<<argv[1]<<endl;
exit(1);
}
string input = string(istreambuf_iterator<char>(ifs),istreambuf_iterator<char>());
reader(input.c_str());
//cout << *reader(input.c_str()) << endl;
exit(1);
}