ReactOS 0.4.15-dev-8119-g4fb2fdb
gcvt.c File Reference
#include <precomp.h>
Include dependency graph for gcvt.c:

Go to the source code of this file.

Functions

char *CDECL _gcvt (double number, int ndigit, char *buff)
 
int CDECL _gcvt_s (char *buff, size_t size, double number, int digits)
 

Function Documentation

◆ _gcvt()

char *CDECL _gcvt ( double  number,
int  ndigit,
char buff 
)

Definition at line 28 of file gcvt.c.

29{
30 if (!buff) {
31 *_errno() = EINVAL;
32 return NULL;
33 }
34
35 if (ndigit < 0) {
36 *_errno() = ERANGE;
37 return NULL;
38 }
39
40 sprintf(buff, "%.*g", ndigit, number);
41 return buff;
42}
#define EINVAL
Definition: acclib.h:90
#define ERANGE
Definition: acclib.h:92
#define NULL
Definition: types.h:112
static unsigned char buff[32768]
Definition: fatten.c:17
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static unsigned int number
Definition: dsound.c:1479
_CRTIMP int *__cdecl _errno(void)
Definition: errno.c:17

◆ _gcvt_s()

int CDECL _gcvt_s ( char buff,
size_t  size,
double  number,
int  digits 
)

Definition at line 47 of file gcvt.c.

48{
49 int len;
50
51 if (!buff) {
52 *_errno() = EINVAL;
53 return EINVAL;
54 }
55
56 if (digits < 0 || digits >= size) {
57 if (size)
58 buff[0] = '\0';
59
60 *_errno() = ERANGE;
61 return ERANGE;
62 }
63
64 len = _scprintf("%.*g", digits, number);
65 if (len > size) {
66 buff[0] = '\0';
67 *_errno() = ERANGE;
68 return ERANGE;
69 }
70
71 sprintf(buff, "%.*g", digits, number);
72 return 0;
73}
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_ _CRTIMP int __cdecl _scprintf(_In_z_ _Printf_format_string_ const char *_Format,...)
static const int digits[]
Definition: decode.c:71