home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!ames!network.ucsd.edu!jracine
- From: jracine@weber.ucsd.edu (Jeff Racine)
- Newsgroups: comp.lang.c
- Subject: printf() waiting for loop(s) to finish - how to override...
- Date: 2 Sep 1992 04:44:25 GMT
- Organization: University of California, San Diego
- Lines: 39
- Distribution: world
- Message-ID: <181gr9INNle8@network.ucsd.edu>
- NNTP-Posting-Host: weber.ucsd.edu
- Summary: Some compilers do, some don't...
- Keywords: printf(), waiting for loop finish, gcc and cc _but_ not ztc, bcc.
-
- When I compile a program with the following code on an HP system using
- cc or using gcc (both on the HP or under MessDOS) the following
- printf() statement only prints after both loops are finished. Since
- the statement tells me where in the total number of replications the
- program currently is, this depeats the purpose of the statement!
-
- This does not happen when the program is compiled with bcc or ztc
- (Borland or Zortech).
-
- Question: Is there a (simple) way to override this delayed screen I/O?
-
- Here is the offending code (if it is of any use). Thanks in advance
- for any help or pointers.
-
- ------------------------------------------------------------------
- for(i = 0; i < num_cv_rep; i++) {
-
- printf("\rReplication %d", i+1); /* non-executing statement */
-
- fprintf(File11,"%f\t", mker_ne(x, scale_fac, num_va, num_ob));
-
- for(m=0; m < num_va; m++) {
- fprintf(File11,"%f\t", scale_fac[m]);
- scale_fac[m] += inc_flt;
- }
-
- fprintf(File11, "\n");
-
- }
- -----------------------------------------------------------------
- p.s. the function mker_ne() is a computationally intensive function
- and may take, say, 20 seconds to execute - I wish to execute the
- function with different values of scale_fac, say, 100 different
- values. Thus the value in knowing where the program is at.
- --
- -----------------------------------------------------------------------------
- Jeff Racine
- jracine@weber.ucsd.edu
- racine@nexus.yorku.ca
-