実際には、以下のプログラムは Rabin-IDA と呼ばれる分散アルゴリズム用です。このアルゴリズムは、データを N 個の断片に分割し、M 個の断片から再結合します (そのようにM<N
)。
したがって、以下のプログラムにはコマンド ライン引数が必要です。これは、プロジェクトのプロパティ/デバッグによって入力されます。この引数はファイル名であり、実行するプログラムがファイルを N 個のファイルに吐き出し、M 個の分割ファイルから再結合し、その名前を引数として渡す必要がある別のファイルに配置します。
今私の質問は、このプログラムにキーボードでファイル名を入力させるにはどうすればよいですか??(コマンドライン引数としてではなく、画面からユーザーがファイル名を入力することを意味します)
以下のコードはプログラムの主な機能であり、その全体はこのリンク ( http://www.juancamilocorena.com/home/projects ) 情報分散アルゴリズム Rabin-IDA にあります。
#include "include.h"
void __cdecl _tmain(int argc, TCHAR *argv[])
{
DWORD ini=GetTickCount();
try
{
if( argc == 3 ) //recombine
{
RabinIDA rabin=RabinIDA(17,10);
long long size=GetFileSize(argv[1]);
int f[]={0,2,3,5,6,8,9,11,14,15};
rabin.recombine(argv[1],
f,
argv[2],
size);
}
else if(argc == 2)
{
RabinIDA rabin=RabinIDA(17,10);
rabin.split(argv[1]);
}
else
{
printf("Error. To split a file pass a parameter with the file to be splitted\n");
printf("To recombine the file give the name of the original file and the output file\n");
printf("The name of the file is used to get the size of the original file only, in a production\n");
printf("environment the length of the original file and the id of the share must be stored along with the share");
return;
}
printf("%d\n",GetTickCount()-ini);
}
catch (int)
{
PrintLastError(_T("MAIN CATCH"));
}
}