Not a bug, so likely the wrong forum.

Have you tried doing a fflush() after the fputs()? I.e. something to tell
the Kernel to "write this out immediately!". In the case of write(), I
think you need to use the O_SYNC flag in the open() call.

On Mon, Aug 31, 2015 at 11:25 AM, Robert Parker <rlp1...@gmail.com> wrote:

> 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.
>



-- 

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

Reply via email to