-
Notifications
You must be signed in to change notification settings - Fork 0
/
cppfileoperations.cpp
63 lines (55 loc) · 1.07 KB
/
cppfileoperations.cpp
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
58
59
60
61
62
63
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <ios>
#include <stdexcept>
//#include "grade.h"
#include <iomanip>
#include <map>
#include <sstream>
//#include <boost/filesystem.hpp>
#include <conio.h>
#include <fstream>
#include <cstring>
using namespace std;
int* invalid_pointer(){
int x;
return &x;
}
int* pointer_to_static(){
static int x;
return &x;
}
int* pointer_to_dynamic(){
return new int(0);
}
char* duplicate_chars(const char* p){
size_t lenght=strlen(p)+1;
char* result=new char[lenght];
copy(p,p+lenght,result);
return result;
}
int main(int argc, char** argv){
//dosya oluþturma
/*ifstream infile("in");
ofstream outfile("out");
string s;
while (getline(infile, s))
outfile << s << endl;*/
//yazý yazma - guzel bilgi
int fail_count=0;
for(int i=0; i<argc;++i){
ifstream in(argv[i]);
if(in){
string s;
while(getline(in,s))
cout<<s<<endl;
}
else{
cerr<<"cannot open file "<<argv[i]<<endl;
++fail_count;
}
}
return fail_count;
}