public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* fprintf with old fortran type format
@ 2004-04-27 13:50 Ph. Piot
       [not found] ` <Pine.LNX.4.44.0404270845480.26831-100000@d-6523-ad.dhcp.fn al.gov>
  0 siblings, 1 reply; 3+ messages in thread
From: Ph. Piot @ 2004-04-27 13:50 UTC (permalink / raw)
  To: gcc-help

Hello All, 

I have a simple C-application under linux that dumps 
a file following the fortran format (for reason of 
compatibility with another fortran code):

 -5.8500E-06  6.1379E-06  3.7700E+00 -8.6851E+00  1.6587E+01  1.7789E+07  
1.2686E+01 -2.0000E-04   1   5
  7.8154E-04 -7.6327E-05  7.7007E-04  1.3974E+02 -2.4259E+03 -2.3236E+04  
1.5000E-03 -2.0000E-04   1   3
 -1.0805E-04  7.5232E-04 -9.3542E-04  2.4451E+03  4.1420E+02  2.0763E+04 
-1.5000E-03 -2.0000E-04   1   3
  1.6066E-03 -1.6012E-04  1.4611E-03  2.3279E+02 -4.7181E+03 -4.0685E+04  
3.0000E-03 -2.0000E-04   1   3
 -2.9795E-05  1.6006E-03 -1.7185E-03  4.7022E+03  5.9128E+02  2.1321E+04 
-3.0000E-03 -2.0000E-04   1   3
  2.3934E-03 -6.3027E-04  1.9306E-03  1.2812E+02 -7.1726E+03 -5.6825E+04  
4.5000E-03 -2.0000E-04   1   3



Under linux I used the syntax:
                fprintf (fh," %' '.4E %' '.4E %' '.4E %' '.4E %' '.4E %' 
'.4E %' '.4E %' '.4E %' 'd %' 'd\n", 
                        X[i][0], X[i][1], X[i][2], X[i][3], X[i][4], 
X[i][5], 
                        X[i][6],X[i][7], (int)X[i][8], (int)X[i][9]);

which work well. When I try to compile this under windows it does 
not work anymore but dumps the "'" in the output file. 

Anybody has some suggestion? 

Thank you in advance, 

             -- Philippe Piot. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fprintf with old fortran type format
       [not found] ` <Pine.LNX.4.44.0404270845480.26831-100000@d-6523-ad.dhcp.fn al.gov>
@ 2004-04-27 14:01   ` Eljay Love-Jensen
  2004-04-28 14:08     ` Ph. Piot
  0 siblings, 1 reply; 3+ messages in thread
From: Eljay Love-Jensen @ 2004-04-27 14:01 UTC (permalink / raw)
  To: Ph. Piot, gcc-help

Hi Philippe,

It looks like your were using a printf extension.  (A couple of extensions, 
for instance:  SUSv2, and/or glibc 2.2.)

I recommend converting your printf parameters from...
%' '.4E
...to...
% .4E

Taking out the (unnecessary and unsupported) apostrophes should help.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fprintf with old fortran type format
  2004-04-27 14:01   ` Eljay Love-Jensen
@ 2004-04-28 14:08     ` Ph. Piot
  0 siblings, 0 replies; 3+ messages in thread
From: Ph. Piot @ 2004-04-28 14:08 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: gcc-help

Hello Eljay,

  Thank you very much for your help, my application 
now works under window. 

  All the best, 

          -- Philippe. 


On Tue, 27 Apr 2004, Eljay Love-Jensen wrote:

> Hi Philippe,
> 
> It looks like your were using a printf extension.  (A couple of extensions, 
> for instance:  SUSv2, and/or glibc 2.2.)
> 
> I recommend converting your printf parameters from...
> %' '.4E
> ...to...
> % .4E
> 
> Taking out the (unnecessary and unsupported) apostrophes should help.
> 
> HTH,
> --Eljay
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-04-28 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 13:50 fprintf with old fortran type format Ph. Piot
     [not found] ` <Pine.LNX.4.44.0404270845480.26831-100000@d-6523-ad.dhcp.fn al.gov>
2004-04-27 14:01   ` Eljay Love-Jensen
2004-04-28 14:08     ` Ph. Piot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).