-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanner.cpp
More file actions
57 lines (48 loc) · 920 Bytes
/
Scanner.cpp
File metadata and controls
57 lines (48 loc) · 920 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
50
51
52
53
54
55
56
57
#include "Scanner.h"
#include <string>
#include <iostream>
#include <iostream>
#include <ncurses.h>
using namespace std;
Scanner::Scanner(string txt){
text=txt;
file=new ifstream(txt);
}
void Scanner::print(int move, int x){
string line;
if (!file->is_open()) {
file->clear();
file->open(text);
}
while (getline(*file,line)) {
mvprintw(move, x, "%s", line.c_str());
move++;
}
file->close();
}
void Scanner::wprint(WINDOW* ventana, int move, int x){
string line;
if (!file->is_open()) {
file->clear();
file->open(text);
}
while (getline(*file,line)) {
mvwprintw(ventana, move, x, "%s", line.c_str());
move++;
}
file->close();
}
void Scanner::sout(){
string line;
if (!file->is_open()) {
file->clear();
file->open(text);
}
while (getline(*file,line)) {
cout<<line <<endl;
}
file->close();
}
Scanner::~Scanner(){
delete file;
}