Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <stdio.h>
- using namespace std;
- struct messaggio { char msg[100]; };
- messaggio a;
- void scrivi()
- {
- ofstream fout("chat.txt");
- cout <<">> "; cin>>a.msg;
- fout.write((char *) &a, sizeof a);
- fout.close();
- }
- void leggi(){
- ifstream fin("chat.txt");
- cout <<"Out >>: "<<a.msg<<endl;
- fin.close();
- }
- int main() {
- while(true) {
- leggi();
- scrivi();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement