Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenwitoa.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS system libraries 00004 * FILE: lib/msvcrt/stdlib/itoa.c 00005 * PURPOSE: converts a integer to ascii 00006 * PROGRAMER: 00007 * UPDATE HISTORY: 00008 * 1995: Created 00009 * 1998: Added ltoa by Ariadne 00010 * 2006 : replace all api in this file to wine cvs 2006-05-21 00011 */ 00012 /* */ 00013 #include <precomp.h> 00014 00015 /* 00016 * @implemented 00017 * copy _i64toa from wine cvs 2006 month 05 day 21 00018 */ 00019 char* _i64toa(__int64 value, char* string, int radix) 00020 { 00021 ULONGLONG val; 00022 int negative; 00023 char buffer[65]; 00024 char *pos; 00025 int digit; 00026 00027 if (value < 0 && radix == 10) { 00028 negative = 1; 00029 val = -value; 00030 } else { 00031 negative = 0; 00032 val = value; 00033 } /* if */ 00034 00035 pos = &buffer[64]; 00036 *pos = '\0'; 00037 00038 do { 00039 digit = val % radix; 00040 val = val / radix; 00041 if (digit < 10) { 00042 *--pos = '0' + digit; 00043 } else { 00044 *--pos = 'a' + digit - 10; 00045 } /* if */ 00046 } while (val != 0L); 00047 00048 if (negative) { 00049 *--pos = '-'; 00050 } /* if */ 00051 00052 memcpy(string, pos, &buffer[64] - pos + 1); 00053 return string; 00054 } 00055 00056 00057 /* 00058 * @implemented 00059 */ 00060 char* _ui64toa(unsigned __int64 value, char* string, int radix) 00061 { 00062 char buffer[65]; 00063 char *pos; 00064 int digit; 00065 00066 pos = &buffer[64]; 00067 *pos = '\0'; 00068 00069 do { 00070 digit = value % radix; 00071 value = value / radix; 00072 if (digit < 10) { 00073 *--pos = '0' + digit; 00074 } else { 00075 *--pos = 'a' + digit - 10; 00076 } /* if */ 00077 } while (value != 0L); 00078 00079 memcpy(string, pos, &buffer[64] - pos + 1); 00080 return string; 00081 } Generated on Sat May 26 2012 04:35:36 for ReactOS by
1.7.6.1
|