Finished program: Computer Backup, any opinions?

I finished a program I had been working on for about 3 days about 1 day ago, and have uploaded the source code.

http://pastebin.com/Jiu7a7hJ

Since I am not currently enrolled in school yet, and have been learning (by myselkf with nothing but the internet) C++ for about a year now, I would like professional opinions on my progress, or opinions from someone more experienced than I.

I know it could be WAY more efficient, but it works, and does the job right.

Notes:

- Use the latest version of Boost to compile

- Some files have trouble being deleted for some reason. I believe it has to do with their properties (security properties, administrative security, etc...), so make sure to remember which files you back up can't be 'cleaned' from the target directory. I don't know how to fix this, so I wont try. I can say that it has no trouble with large amounts of data, I myself use this and have created a 68.13 Gb backup using this program.

- run it with administrator priveliges on windows 7. That was it's developement environment, and it's compatability. Also, it need to run in admin for file-size calculations, and directory iterations.

- I'm not responsible for any data loss during your use of this program. You chose to use it, and it is your fault if you do somthing stupid with it.

That said...

Please offer any opinions you may have, I worked hard on it.

Also, don't comment about there being no GUI. I tried to build a GUI library to no avail. :'(

Also:

How would you define my programming skills?

novice
mediocre
good
excelent
expert
professional

Thanks!

I just want to get an idea of where I am.
Last edited on
Hi

If you want to back up your files as a single zip file, or even as a group of files in folder, then see:

MediaFile
http://www.mediafire.com/

You can then grant people access to some or all of your files.

Andy
Last edited on
@IWishIKnew
Couldn't you have posted the links here, so we wouldn't have to copy/paste each one?



Edit: Is this function just converting an int to a std::string?
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
string conv_int(int x)
{
    ifstream in;
    ofstream out;
    string s;
    s.clear();
    out.open("temp.dat", ios::out);
    while((is_file("temp.dat", true) == true) && (!out.is_open()))
    {
        continue;
    }
    out<< x;
    out.close();
    in.open("temp.dat", ios::in);
    while((is_file("temp.dat", true) == true) && (!in.is_open()))
    {
        continue;
    }
    getline(in, s);
    in.close();
    remove("temp.dat");
    in.clear();
    out.clear();
    return s;
}


if so, heres one of a dozen more efficient ways to do it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <string>
#include <sstream>
 
using namespace std;
 
int main()
{
    int x = 999;
    
    stringstream ss;
    ss<<x;
    std::cout<<ss.str();
}


And from string to int...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string>
#include <sstream>
 
using namespace std;
 
int main()
{
    string x = "999";
    
    stringstream ss;
    ss<<x;
    int y = 0;
    ss >> y;
    std::cout<<y;
}

http://www.cplusplus.com/reference/iostream/stringstream/

I also see you are passing many objects (strings and vectors ) by value when you should use constant reference. For example void save_directories(vector<string> directories) could/should be void save_directories(const vector<string>& directories)
Last edited on
As OP already uses Boost, just using lexical_cast will do the trick.
alright.

question:

If I understand correctly...

stringstream ss;
int x = 5;
ss<< x;
cout<< ss.str()<< endl;

that would output "5", right?

I will start using that instead of file output functions. Thank you!!

I also noticed from other posts that stringstream can be used to convert character strings into integers. Would this be a reliable encryption technique?

@andywestken
I do not trust any websites that offer to store my data. Just look at google. They sell their customer's data to advertising. Another reason is that I do not want a backup program that compresses my data, or formats it. I want my data literally backed up. No compression, no formatting, no nothing. Also, the fact that some of the data I want backed up is sensitive does not make me want to use a 3rd party program.

With my program, you get to choose every folder you want to back up, or you can choose files indevidually. You can also have you computer be put to sleep when it finishes backing up, for those time where you do not want to stay up until 11:00pm to shut your computer down.

I like it simple, so I made somthing simple. Also, windows backup only works if your hard drive's size does not change. I descovered that the hard way when my drive failed and I got a new one with 200 more Gb of space.

But, one of the main reasons I do not want a 3rd party program is because I wanted to test myself. I love to constantly push my programming skills to the limit, and for that I am better.

Thank you for your input, andywestken.
Last edited on
Ha ha, go C++98!
1
2
3
4
5
6
7
8
#include <sstream>
#include <string>

template <typename Number>
std::string numberToString(Number n)
{
    return dynamic_cast<std::stringstream *> (&(std::stringstream() << n))->str();
}


modoran wrote:
As OP already uses Boost, just using lexical_cast will do the trick.

Quoted for relevance.
I created a new post for my questions about stringstream:

http://www.cplusplus.com/forum/general/83560/

Please help me out, thank you.
Last edited on
Anyone else who wants to offer advice or comments about my program, please feel free to do so.
Last edited on
IWishIKnew wrote:
I do not trust any websites that offer to store my data. Just look at google. They sell their customer's data to advertising.

Now that's what I call being misinformed. Do you know how much spam I get in my GMail account? Zero. Not a single message by a long shot. Maybe 1 or 2 per year because they got so darn clever that found an incredible and awesome way to pass Google's anti-spam super amazing filter.

So in light of the no-spam evidence in my email, and being myself an avid Google user (using an Android phone), I can honestly say they don't sell your personal information. They just aggregate data anonymously and that's what they commerce with.
@ webjose

And that's exactly why I am not putting all my data in their stuff.

If you want to start a privacy thread go ahead.
IWishIKnew wrote:
And that's exactly why I am not putting all my data in their stuff.

Did not get this remark. I don't see how my remarks justify the action in any way. But no response needed as I don't really want to discuss the subject. I just wanted to let you know that I fail to see the logic in the statement.
I just wanted to let you know that I fail to see the logic in the statement.


They just aggregate data anonymously and that's what they commerce with.

He don't be liking that.

But he's got a point. "Anonymously"? In that they don't store your personal details, but all of your preferences and search history?
Yes, it is data they find useful. In turn, I get awesome email services, awesome maps, awesome search engine, awesome mobile operating system, awesome software like Google Earth, Google Translate, etc. And the data cannot be traced back to me, so who cares? How much would it cost all those services in the traditional model where you buy a license or pay monthly fees?
we are talking about files, not services.

I did not say that i did not like google translate and whatnot. I just said I am not using a third party program to back up all of my sensitive data onto some remote server for free, and trust that they wont take a peek at it.

Please stick to the topic, thank you.
Topic archived. No new replies allowed.