File Sharing using IDs

Ok so I've been coding for a few years not but I really want to start doing some cool stuff. I know this sucks so far because I have no clue where to start with the file inputs and target IPs. I've read a little bit about sockets but still am a little confused. So far I made a program that writes imputed string variables to a text file. I made the message an integer just for easy testing purposes.

Objective: Have a user send a file to another person by inputing their target IP address.

Updated Code:
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
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main () 
{
  system("color 0A");
  
  //Variables
  string username;
  string target;
  int message;
  
  //Get Variables
  cout << "Username: ";
  cin >> username;
  cout << "Target: ";
  cin >> target;
  cout << "Message: ";
  cin >> message;
  
  //Writter
  ofstream Writter;
  Writter.open ("message.txt");
  Writter << "To: " << target;
  Writter << endl;
  Writter << "From: " << username;
  Writter << endl;
  Writter << endl;
  Writter << message;
  Writter << endl;
  Writter << endl;
  Writter << "-----------";
  Writter << endl;
  Writter << "END MESSAGE";
  Writter << endl;
  Writter << "-----------";
  Writter.close();
  
  system("pause");
  return 0;
}
Last edited on
Topic archived. No new replies allowed.