/[MITgcm]/mitgcm.org/devel/buildweb/code-browser/F90Mapper/base36.c
ViewVC logotype

Annotation of /mitgcm.org/devel/buildweb/code-browser/F90Mapper/base36.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Thu Jan 17 21:05:34 2008 UTC (17 years, 6 months ago) by cnh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -0 lines
File MIME type: text/plain
Standard incs that need to be there these days.

1 cnh 1.2 #include <string.h>
2 adcroft 1.1 char *base36(n)
3     /* Returns a character string representing an integer in base 36 */
4     int n;
5     {
6     char *base = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
7     int i, l;
8     char buffer,num[500];
9     static char rev[500];
10     i = strlen(base);
11     l=0;
12     while ( n > i-1 ) {
13     num[l]=base[n-i*(n/i)];
14     ++l;
15     n = n/i;
16     }
17     num[l]=base[n];
18     rev[l+1]='\0';
19     for (i=0;l>=0;--l){
20     rev[i]=num[l];
21     ++i;
22     }
23     return(rev);
24     }
25    

  ViewVC Help
Powered by ViewVC 1.1.22