If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

enter the file name by keyboard instead of command line arguments?

Actually the below program is for Dispersal Algorithm called Rabin-IDA; this algorithm divided the data into N pieces and then recombine it from M pieces (such that M<N).

Thus, the below program needs command line arguments,which entering by Project properties/Debugging. this argument is file name, where the program performing spitted the file into N files, and then recombine it from M divided files, and put it on another file which should also passing its name as argument .

Now my question is, How can i make this program enter the file name by keyboard??(i mean enter the files name by user from screen not as command line arguments)
In another word, How I can exchange

Code:

argc == 3

and

Code:

argc == 2

to enter file name ? i mean what i should do to in

Code:

rabin.split(argv[1])

to pass my file name by use keyboard not Project properties/Debugging?)

#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"));
}
}