LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Fortran like - variable length format strings in CVI

I have a boat load of variable length format strings from some old fortran code and it needs to be converted to CVI.  Here is an example
 
Digits = 6
Decimal = 4
Temp = 34.654321
 
Write (*100) temp
100 format(  "The temp is" F6.2 )
 
 
I want to print a F6.2 format once and then latter print the same number as a F6.4.   How would you do this?
 
thanks .
 
the old vax guy
 
 
0 Kudos
Message 1 of 2
(2,870 Views)
1st of all, I don't speak Fortran, so it can be that I misunderstand your question!
In regular C, the printf formating would be:
- printf("The temp is %6.2f\n",temp) to have 4 digit before the decimal point and 2 digit after.
- printf("The temp is %6.4f\n",temp) to have 2 digit before the decimal point and 4 digit after.
See for example: Kernighan & Ritchie, The C  programming language (2nd edition), page 13.
Regards
0 Kudos
Message 2 of 2
(2,854 Views)