payredu

Cross-platform ledger GUI written in c99
git clone git@getsh.org:payredu.git
Log | Files | Refs | README

strn.h (254B)


      1 #ifndef _STRN_H
      2 #define _STRN_H
      3 
      4 int natoi(char* str, size_t len) {
      5 	int final = 0;
      6 	size_t i = 0;
      7 	// ignore leading zeroes
      8 	while(i < len && str[i] == '0') i++;
      9 	for(;i < len; i++) {
     10 		final *= 10;
     11 		final += str[i] - '0';
     12 	}
     13 	return final;
     14 }
     15 
     16 
     17 #endif