Hi all,
My problem is regarding to my last post about argument. that is solved but it create a new problem. The last data in debug_file is not written in output file. I think its because of looping in the argument.How to solve this?
int main(int argc, char* argv[])
{
remove(debug_file);
count=0;//count d number of seeding
for (int i = 1; i < argc; i++)
{
/* Check for a switch (leading "-") */
if (argv[i][0] == '-')
{
/* Use the next character to decide what to do. */
switch (argv[i][1])
{
case 'i': strcpy (input_file,argv[++i]);
printf ("Input file = %s\n", input_file);
break;
case 'o': strcpy (output_file,argv[++i]);
printf ("Output file = %s\n", output_file);
break;
case 's': strcpy (seed,argv[++i]);
strcpy (seed_array[count],seed);
seeding();
count++;
break;
default: printf ("Invalid selection \n");
break;
}
}
}
CleanUp();
printf ("Running Completed......\n");
getch();
return 0;
}
this is my input
-i fruit.flt -o out -t 2 -s flower, -s oren, -s banana,
first, i put all these seeds into the debug_file,then from the debug file only pass to output file because of operating sumthing.But,this cause the problem which is the last data:banana is not written in the output file.How this happen and how to solve this?