Fct_Float_2_Dist

 

Convert a floating point value to a text string.

 

 

Syntax

 

char * Fct_Float_2_Dist

          double distance, 

          char *units=NULL, 

          char *str=NULL

) ;

 

 

Parameters

 

distance

Original floating point value of the distance (in mm).

 

units

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

 

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

 

...

 

// ----------------------------------------------------------------------------

//

//          Measures:Text

//

//          Param:          text (Texts *)          text tools

//

//          Return:          (int)                    NULL if error

//

// ----------------------------------------------------------------------------

int          Dist2Line::Text( Texts *text )

{

          char units[10], *str ;

 

          str = Fct_Float_2_Dist( this->val_AB, units ) ;

          text->Write( "dist A to B:        \xF1%s\xF0 \001(%s)", str, units ) ;

 

          str = Fct_Float_2_Dist( this->val_AC, units ) ;

          text->Write( "dist A to C on AB:  \xF1%s\xF0 \001(%s)", str, units ) ;

 

          str = Fct_Float_2_Dist( this->val_CB, units ) ;

          text->Write( "dist C to B on AB:  \xF1%s\xF0 \001(%s)", str, units ) ;

 

          str = Fct_Float_2_Dist( this->val_dist, units ) ;

          text->Write( "dist C to AB:       \xF1%s\xF0 \001(%s)", str, units ) ;

          return( 1 ) ;

}

...

 

 

See also