Message printing problem

This is a discussion on Message printing problem within the C Programming forums, part of the General Programming Boards category; I am having trouble to print a message before user's input from command window.
I wrote a read() method in ...

It prints a message to ask user to input some figures. However the problem is when I call this method in another file called "processor.c", it doesn't call the printf to print out the message first, then take in the input from the user. Instead, it waited for the user input, after the user input, at the end of the execution of the program, it printed out "Please input the data: \n". The "processor.c" program is like this:

So the read() method is called in the execute() this method, funny thing about this is if I put perror() this function inside the read() method, read() method will print out the error message with Error 0 before the user input, then after the user input, it would then print out the "Please input the data: \n" this message. here is the result after execution:

"Please input the data: : Error 0" is the message from the perror() functin, 23 and 54 are the inputs from me, and "Please input the data:" is from the printf() function. I am really puzzled by this as both perror and printf functions are before scanf() function in the read() method, so both of them should be printed before the scanf function, however, in fact, it is one before, and one after. Initially, I was thinking it may be coursed by the input file, so I used fclose() and fflush() as well. But none of them worked. Why could this happen??? I would very much appriciated if somebody could help me for this. Thank you.