how can i make this program enter this file (arguments) and its content from screen (not as command line arguments)

actually, the below program is a console program, and needs command line arguments, that are as files i'm entering from (project properties-Visual studio c++ 2008). how can i make this program enter this file (arguments) and its content from screen by user(not as command line arguments)??



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









this is a link of whole program (http://www.juancamilocorena.com/home/projects) Information Dispersal Algorithms Rabin-IDA.



Despite your horrible indentation (use
[code]
C-Program
[/code]
please to format your code) and those mysterious Microsoft stuff like DWORD, ...

... you may either use scanf(3) from <stdio.h> for C-programs or better operator>>() on `cinĀ“ for a C++ program.

see http://www.cplusplus.com/reference/cstdio/scanf/ for scanf(3)
and http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/ for operator>>()
Topic archived. No new replies allowed.