× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Simon,

On 20th October 2005 Simon Coulter wrote:

Long Answer:
Search the archives. Barbara Morris provided an explanation of why C and RPG behave differently in this respect.

Short Answer:
Force the console to redisplay and wait by issuing a getchar() after you do the final printf().


Many apologies for not getting back to this sooner. However...

I used getchar() to force the redisplay and it all looks great and gorgeous. This is what I assumed would be needed, but just needed to check for better ways.

I couldn't find the explanation from Barbara on how things are different for RPG and C with respect to printf and the console. It's interesting though, because I get a very similar problem when running a C executable on my PC from two different environments. That is, if I open a DOS prompt and run the exe I can still see the output after the exe has completed. If I run the exe from within an IDE like DEV++ The DOS prompt window is opened, the exe is run and the window is closed - just like when I run a RPG program which uses printf. I can see that this happens is because the prompt window was opened for specifically running the exe in the latter case, and I can see that something similar must occur for running a RPG program on the iSeries which uses printf. What I can't see is why running a C program on the iSeries should behave differently in the respect of keeping the console open. I could understand it if the C program was run from within the console, like running it from an already open DOS prompt, but I can't understand why it would be different for two programs called from QCMD.

Or am I getting this completely wrong? Just curious, and thanks for your help.

Cheers

Larry Ducie



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.