-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmovingfile.cpp
More file actions
41 lines (38 loc) · 882 Bytes
/
movingfile.cpp
File metadata and controls
41 lines (38 loc) · 882 Bytes
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
#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <exception>
#include <fstream>
#include <string>
#include <thread>
#include <vector>
#include <ctime>
using namespace std;
//MOVING FILE
int main()
{
float n = 0.05;
//displaymemory(n);
int result = 1;
char oldname[500];
char newname[500];
cout << "Enter the name of a file you want to move (include directory structure)" << endl;
cin >> oldname;
cout << "Enter the new location (include directory structure)" << endl;
cin >> newname;
result = rename(oldname, newname);
if (result == 0)
cout << "File successfully moved" << endl;
else
cout << "Error moving file" << endl;
std::cin.get();
std::cin.get();
return 0;
}