delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/01/01:54:21

Date: Sat, 31 May 1997 22:40:26 -0700 (PDT)
Message-Id: <199706010540.WAA09786@geocities.com>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: Guilherme Silveira <thedarkage AT mail DOT geocities DOT com>
Subject: Re: how to convert float ->int?

There's the way to convert from float to int:

Function FCVT (propabily Float Converter)

Syntax

#include <stdlib.h>
char *fcvt(double value, int ndig, int *dec, int *sign);

Description

Converts a floating-point number to a string.
fcvt converts value to a null-terminated string digit starting with the
leftmost significant digit with ndig digits to the right of the decimal
point. fcvt then returns a pointer to the string. The position of the
decimal point relative to the beginning of the string is stored indirectly
through dec (a negative value for dec means to the left of the returned
digits). There is no decimal point in the string itself. If the sign of
value is negative the word pointed to by sign is nonzero; otherwise it is 0.
The correct digit has been rounded for the number of digits to the right of
the decimal point specified by ndig.

Return Value

The return value of fcvt points to static data whose content is overwritten
by each call to fcvt and ecvt.

I'll be happy if it helps you. (of course it will.)

This is a part of help from Borland C 4.0

That's the waY!
Guilherme
------------------------------------------------
Guilherme Silveira - Sao Paulo - Brasil
carlos AT usway DOT com - thedarkage AT mail DOT geocities DOT com
http://www.geocities.com/SiliconValley/5441/
18/09/1981 - Until Today...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019