This is the program which creates the image of FDD.
I want to change the program which copies the specified file.
And lose the start function after pushing key.
Where should I modify?
(ex;
a:\>dir
A.txt
B.txt
program.exe
a:\>program.exe A.txt(enter) <- Copy start
end
)
I am sorry to be an elementary question.
mary

-----
int main(int argc, char *argv[])
{
int i, j, error;
int drive;
FILE *fp;
char *cptr, a, b;

if (argc < 3)
{
printf("\n\ndskcpy [drive:] [filename] or dskcpy [filename] [drive:]\n");
return(1);
}

cptr = argv[1];
i = strlen(cptr) - 1;
a = cptr[i];

cptr = argv[2];
j = strlen(cptr) - 1;
b = cptr[j];

if (a == ':' && b == ':')
{
printf("\ninvalid arguments\n");
return(1);
}

if (a == ':')
{
direction = DISKETTE_TO_FILE;
filename = argv[2];
drive = toupper(*argv[1]) - 'A';

}
else if (b == ':')
{
direction = FILE_TO_DISKETTE;
filename = argv[1];
drive = toupper(*argv[2]) - 'A';
}
else
{
printf("\ninvalid arguments\n");
return(1);
}

if (drive < 0 || drive > 1)
{
printf("\n\nInvalid drive letter\n");
return(1);
}

if (direction == FILE_TO_DISKETTE)
fp = fopen(filename, "rb");
else
fp = fopen(filename, "wb");

if (!fp)
{
printf("\nCan't open disk file!\n");
return(1);
}

if (direction == FILE_TO_DISKETTE)
error = write_disk(drive, fp);
else
error = read_disk(drive, fp);

printf("\nSuccess.\n");

return(error);
}

int read_disk(int drive, FILE *fp)
{
int i, error, size;
int track, cyl, sec, head;

error = FALSE;
printf("\nInsert source diskette and press <ENTER>... "); <-delete.
i = getch();
printf("\n");
if (i == ENTER)
{
i = get_drive_parameter(drive, fp);
if (i)
return(1);

size = max_sec * BYTES_PER_SECTOR;

for (track=0; track<=max_cyl; track++)
{
error = read_track(drive, track, max_sec, 0);
if (error)
{
printf("\nError reading track %d\n", track);
break;
}
fwrite(buffer, 1, size, fp);
if (max_head)
{
error = read_track(drive, track, max_sec, 1);
if (error)
{
printf("\nError reading track %d\n", track);
break;
}
fwrite(buffer, 1, size, fp);
}
}
fflush(fp);
}
fclose(fp);
recal(drive);
return(error);
}