CustomCrypto.com

Remote Uploader

Table of Contents

Introduction

To write

Fixing the TARGET_LOC definition

At line 7 of the code you'll see a line with

#define TARGET_LOC "/home/ftp-server/backup-home"
You need to chage the
/home/ftp-server/backup-home
to the folder where YOU want to send the files

string expected_name(){}

This function starts out with

string expected_name(){
 	/*
	
	This is the portion of the program that is written to a custom specification for my employers QuickBooks software.

	*/


	string ret = "test.txt";

 	return ret;
}
	

And it's empty, devoid of code. It's your job here to write an algorithm to determine the expected backup file to upload to the remote server. In my particular case, the file would automaticaly be created by QuickBooks at 4:20PM. The variable portion of the backup file is just the date the backup was created.

string expected_name(){
    /*

    This is the portion of the program that is written to a custom specification for my employers QuickBooks software.

    */
    //grab current date formatted properly
    time_t rawtime;
    struct tm * timeinfo;
    char buffer[128];
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    strftime(buffer, 128, "%b %d,%Y", timeinfo);
    string fdate(buffer);

    string start = "SBU_0_Company Name, Inc.1";
    string time = "04 20 PM";
    string ext = ".QBB";
    string space = " ";

    //making quotes
    char qchar[2] = {34, '\0'};
    string quote = qchar;


    string ret = quote + start + space + fdate + space + time + ext + quote;

    return ret;
}
	

A section of importance is the

char qchar[2] = {34, '\0'};
I had a hard time getting C++ to add a ["] to the string so I used the fact that the C char type doesn't actually care about type. Try
printf("%d", 'a');
to get a bit of an idea about that quirk. The trailing \0 turns the character array into a C type string and then can be input into a C++ string using the default constructor. It's a hack but it works.

If you have a question or you don't know how to code and want to make it work, you can find my email on the front page . I'll help if I have time.

Last Edited: October 10, 2017