Changeset 607


Ignore:
Timestamp:
Jul 13, 2015, 3:10:27 PM (9 years ago)
Author:
guerin
Message:

string: implement strlen()

Location:
soft/giet_vm/giet_libs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/string.c

    r258 r607  
    3737}
    3838
     39///////////////////////////////////////////////////////////////////////////////////
     40// int strlen ( const char * str )
     41///////////////////////////////////////////////////////////////////////////////////
     42int strlen ( const char * str )
     43{
     44    const char *s = str;
     45
     46    while (*s)
     47        s++;
     48
     49    return (s - str);
     50}
     51
    3952// Local Variables:
    4053// tab-width: 4
  • soft/giet_vm/giet_libs/string.h

    r258 r607  
    1111char * strcpy ( char * destination, const char * source );
    1212int strcmp ( const char * str1, const char * str2 );
     13int strlen ( const char * str );
    1314
    1415#endif
Note: See TracChangeset for help on using the changeset viewer.