Little help with code.

Basically I'm trying to copy a file from one place to another but I want the user to be able to change were to because its for a steam game and everyone has a diffident username.


system("copy GameMenu.res C:\\Program Files (x86)\\Steam\\steamapps\\"login"\\counter-strike source\\cstrike\\resource\\GameMenu.res");
In this line where it says "login" I want for people to be able to type their username and so it is still a part of the directory or whatever the thing is called. Please help me.

here is the code here is the whole code so you can see what's wrong with it:

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
#include <iostream>
#include <cmath>
#include <string>
int main ()
{
using namespace std;

string login;


cout << "What is your steam login??" << endl;

cin >> login;

system("timeout 2");

system("cls");

cout << "Your files are being copied " << login << "." << endl;

system("copy GameMenu.res C:\\Program Files (x86)\\Steam\\steamapps\\"login"\\counter-strike source\\cstrike\\resource\\GameMenu.res");

system("pause");

system("cls");

system("timeout 1");

return 0;

}
Last edited on
I guess that you could use $HOME ( %HOMEPATH% or %USERNAME% )
There is no need to wrap a batch file inside a c++ source.
Topic archived. No new replies allowed.