March 10th, 2013, 12:42 AM
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 and to enter file name ? i mean what i should do to in
to pass my file name by use keyboard not Project properties/Debugging?)
the below code is just the main function of program, and the whole of it in this link (http://www.juancamilocorena.com/home/projects) Information Dispersal Algorithms Rabin-IDA.
void __cdecl _tmain(int argc, TCHAR *argv)
if( argc == 3 ) //recombine
long long size=GetFileSize(argv);
else if(argc == 2)
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");
i know i should use getline() function but how exchange argv ?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.