glmwc@marlin.jcu.edu.au (Matt Crowd) (02/06/91)
I'm having a simple problem with a small program in the cli using
the C system call.
program 1 -
#include <stdio.h>
char buff[256];
main()
{
printf("Enter prog name - ");
scanf("%s",buff);
system(buff);
printf("End of prog 1.\n");
}
program 2 -
#include <stdio.h>
char buff[256];
main()
{
printf("Enter a string (the scanf will be skipped!)- ");
scanf("%s",buff);
printf("String was %s\n",buff);
}
-----
This is compiled with Lattice C 5.1. If you run the program and type
the name of program 2 into the string at program 1, the scanf in program
2 will be completely skipped when it is executed using the system call.
I have tried using Execute, and fflush(stdin) without any effect.
Is this my problem, a C= problem or a Lattice problem?? I am
using AmigaDOS 2.02.
I really don't want to have to use Amiga specific code for this.
Thanks in advance,
Colin Adams