mirror of
https://github.com/lucaspalomodevelop/cpp_stuff.git
synced 2026-03-12 22:47:22 +00:00
add param to writefunction
This commit is contained in:
parent
7608773cab
commit
1de13ffb1d
@ -5,11 +5,11 @@
|
||||
using namespace std;
|
||||
|
||||
void readfile(string file);
|
||||
void writefile(string file);
|
||||
void writefile(string file, string text);
|
||||
|
||||
int main()
|
||||
{
|
||||
writefile("./testfile.txt");
|
||||
writefile("./testfile.txt","Hallo Welt!");
|
||||
readfile("./testfile.txt");
|
||||
return 0;
|
||||
}
|
||||
@ -30,14 +30,14 @@ void readfile(string file)
|
||||
}
|
||||
}
|
||||
|
||||
void writefile(string file)
|
||||
void writefile(string file, string text)
|
||||
{
|
||||
string line;
|
||||
ofstream myfile;
|
||||
myfile.open(file,std::ios_base::app);
|
||||
if (myfile.is_open())
|
||||
{
|
||||
myfile << "hallo\n";
|
||||
myfile << text+"\n";
|
||||
}
|
||||
myfile.close();
|
||||
}
|
||||
BIN
cpp_1/program
BIN
cpp_1/program
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
hallo
|
||||
hallo
|
||||
hallo
|
||||
hallo
|
||||
Loading…
x
Reference in New Issue
Block a user