A trivial script example that just works:

#!/bin/bash
# echo a prompt and write the user's response to a file.

echo "Enter variable name: "
read ans
echo "$ans" > tmpfil
echo "Enter variable type: "
read ans
echo "$ans" >> tmpfil
echo "Enter variable default value: "
read ans
echo "$ans" >> tmpfil
echo "Beginning with an assignmment operator"
echo "Enter C code for this option:"
read ans
echo "$ans" >> tmpfil

Yet when I attempt the same in a C program, the system always writes 2
prompts, then waits for a read.
Does not matter if I write(1, "..."); read(0, number, buffer); or use
fputs("...", stdout); fgets(.....
The result is the same.
And I have tried using readline without any better result.

I have downloaded the source code for Bash.
Would someone please let me know where to look to learn to make my code
work like yours?

Thanks, Bob


-- 
The Bundys, Cliven, Ted and Al. Great guys to look up to.

Reply via email to