ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

witow.c
Go to the documentation of this file.
00001 /* $Id: witow.c 54651 2011-12-14 22:09:24Z spetreolle $
00002  *
00003  * COPYRIGHT:   See COPYING in the top level directory
00004  * PROJECT:     ReactOS system libraries
00005  * FILE:        lib/msvcrt/stdlib/itow.c
00006  * PURPOSE:     converts a integer to wchar_t
00007  * PROGRAMER:
00008  * UPDATE HISTORY:
00009  *              1995: Created
00010  *              1998: Added ltoa by Ariadne
00011  *              2000: derived from ./itoa.c by ea
00012  */
00013 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
00014 
00015 #include <precomp.h>
00016 
00017 /*
00018  * @implemented
00019  */
00020 wchar_t* _i64tow(__int64 value, wchar_t* string, int radix)
00021 {
00022   wchar_t tmp[65];
00023   wchar_t* tp = tmp;
00024   int i;
00025   unsigned v;
00026   int sign;
00027   wchar_t* sp;
00028 
00029   if (radix > 36 || radix <= 1) {
00030     _set_errno(EDOM);
00031     return 0;
00032   }
00033 
00034   sign = (radix == 10 && value < 0);
00035   if (sign)
00036     v = -value;
00037   else
00038     v = (unsigned)value;
00039   while (v || tp == tmp) {
00040     i = v % radix;
00041     v = v / radix;
00042     if (i < 10)
00043       *tp++ = i+L'0';
00044     else
00045       *tp++ = i + L'a' - 10;
00046   }
00047 
00048   if (string == 0)
00049     string = (wchar_t*)malloc(((tp-tmp)+sign+1)*sizeof(wchar_t));
00050   sp = string;
00051 
00052   if (sign)
00053     *sp++ = L'-';
00054   while (tp > tmp)
00055     *sp++ = *--tp;
00056   *sp = 0;
00057   return string;
00058 }
00059 
00060 /*
00061  * @implemented
00062  */
00063 wchar_t* _ui64tow(unsigned __int64 value, wchar_t* string, int radix)
00064 {
00065   wchar_t tmp[65];
00066   wchar_t* tp = tmp;
00067   long i;
00068   unsigned long v = value;
00069   wchar_t* sp;
00070 
00071   if (radix > 36 || radix <= 1) {
00072     _set_errno(EDOM);
00073     return 0;
00074   }
00075 
00076   while (v || tp == tmp) {
00077     i = v % radix;
00078     v = v / radix;
00079     if (i < 10)
00080       *tp++ = i+L'0';
00081     else
00082       *tp++ = i + L'a' - 10;
00083   }
00084 
00085   if (string == 0)
00086     string = (wchar_t*)malloc(((tp-tmp)+1)*sizeof(wchar_t));
00087   sp = string;
00088 
00089   while (tp > tmp)
00090     *sp++ = *--tp;
00091   *sp = 0;
00092   return string;
00093 }

Generated on Sat May 26 2012 04:35:36 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.