*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> strlen (3)              



NAME    [Toc]    [Back]

       strlen - Find the length of a string

SYNOPSIS    [Toc]    [Back]

       #include <string.h>

       size_t strlen(
               const char *s );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       strlen(): ISO C, XPG4

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies the string.

DESCRIPTION    [Toc]    [Back]

       The  strlen()  function returns the number of bytes in the
       string pointed to by the s parameter.  The  string  length
       value does not include the terminating null character.


       If  you  pass a NULL pointer as the const char * parameter
       to the strlen function, the function generates a segmentation
  violation.  To  avoid the segmentation violation and
       cause the function to return 0  (zero),  change  the  NULL
       pointer  treatment for the process before issuing the call
       to the strlen function, as  follows:  Include  the  system
       header  file sys/uswitch.h.  Call the uswitch function, as
       described in the uswitch(2) reference page.

       The following program illustrates this procedure:

       #include   <stdio.h>   #include   <sys/types.h>   #include

       main() {
               size_t  retval;
               int     uswitch_val;

               uswitch_val = uswitch(USC_GET,0);
               uswitch(USC_SET, uswitch_val | USW_NULLP);
               retval = strlen(NULL);

RETURN VALUES    [Toc]    [Back]

       On  successful  completion,  the strlen() function returns
       the number of characters (bytes) in the  string  to  which
       the s parameter points. Current industry standards specify
       that no value be reserved to indicate an error.

SEE ALSO    [Toc]    [Back]

       Functions: string(3), uswitch(2), wcslen(3)

       Standards: standards(5)

[ Back ]
 Similar pages
Name OS Title
strlen NetBSD find length of string
strlen OpenBSD find length of a string
strlen FreeBSD find length of string
wcslen Tru64 Find length of wide-character string
strlen Linux calculate the length of a string
len Tru64 return length of Fortran string
len IRIX return length of Fortran string
len IRIX return length of Fortran string
glcmeasurecountedstring IRIX store a string of specified length in measurement buffer
strnlen Linux determine the length of a fixed-size string
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service