Fct_Float_2_Vol

 

Convert a floating point value to a text string.

 

 

Syntax

 

char * Fct_Float_2_Vol(  

          double volume,   

          char *units=NULL, 

          char *str=NULL

) ;

 

 

Parameters

 

volume

Original floating point value of the volume (in mm3).

 

units

If present, the string pointed by this variable will contain the units used for the volume.

 

str

Optional pointer to a text buffer that will contain the results.  If NULL (the default) the result text string will be a static string locate inside the function.

 

 

Return value

 

This function return a pointer to a text string containing a text representation of the floating point value "val"

 

 

Remarks

 

If you do not specify a target string and you call the function twice, the second call to the function will overwrite the value returned by the first call since they will share the same static variable.

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

 

Example

 

...

 

 // --- if Surfaces: gives out surface and volume ---

 if ( mov->Flag & GEOM_POLY ) {

          char str[40], units[10] ;

          float surf = Movie_Surface( mov ) ;

          Fct_Float_2_Surf( surf, units, str ) ;

          fprintf( fp_o, "surface (%s):%c%s\n", units, Regional_Separator, str ) ;

          float vol = Movie_Volume(  mov ) ;

          if ( (vol < 0.0f) || (vol > 1000000.0f) ) {

              fprintf( fp_o, "Volume (%s):%cNot a closed surface\n", units, Regional_Separator ) ;

          } else {

              Fct_Float_2_Vol( vol, units, str ) ;

              fprintf( fp_o, "Volume (%s):%c%s\n", units, Regional_Separator, str ) ;

          }

 }

 

...

 

 

See also