C Reference function asctime()

Usage of asctime():

char * asctime ( const struct tm * ptr_time );

Parameters:

ptr_time is a pointer to a tm structure which in turn contains a calendar time.

Return Value:

The function returns a C string containing the date and time information.
The string is followed by a new-line character (‘\n’) and the terminating null-character. More »


Posted in C Reference time.h Functions | 1 Comment


(ANSI) C Reference: Using stdarg.h for Variable Arguments Handling

There are cases where a function needs to accept varying numbers of arguments of varying type. For this we can use the macros defined in the header file stdarg.h. In this header file (stdarg.h) there macros defined that can be used to access the arguments of a list of unnamed (arguments with no corresponding parameter declarations) arguments.

There is one type described in stdarg.h: More »


Posted in C Reference stdarg.h Functions | Comments Off on (ANSI) C Reference: Using stdarg.h for Variable Arguments Handling


C Reference String Operation: strrchr()

The function strrchr() returns a pointer to the last occurrence of x in a string.

Usage:

char *strrchr( const *str, int x);

Note: NULL will be returned if x isn’t found. More »


Posted in C Reference string.h Functions | 2 Comments


C Reference String Operation: strncpy()

The function strncpy() copies up to n characters of one string to another string.

Usage:

char * strncpy( char * target, const char *source, size_t count); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strncpy()


C Reference String Operation: strncmp()

The function strncmp() compares one string with another string up-to n characters.

Usage:

int strncmp( const char * target, const char * source, size_t count); More »


Posted in C Reference string.h Functions | 2 Comments


C Reference String Operation: strncat()

The strncat() function concatenates up to n characters of one string onto the end of another string.

Usage:

char *strncat(char *target, const char * source, size_t count); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strncat()


C Reference String Operation: strlen()

The strlen() function returns the length of a string.

The length is determined by the number of characters before the null termination.

Usage:

size_t strlen(char *str)

strlen() source code example:

More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strlen()


C Reference String Operation: strcpy()

The function strcpy() copies the characters from one string to another string.

Note: the null termination is also copied.

Usage:

char * strcpy( char *target, const char *source); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strcpy()


C Reference String Operation: strcmp()

The function strcmp() compares one string with another string. The function strcmp() returns a integer value.

Usage:

int strcmp( const char * target, const char * source);

If the two strings are equal then zero is returned. More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strcmp()


C Reference String Operation: strchr()

The function strchr() returns a pointer to the first occurrence of x in a string.

Usage:

char *strchr( const *str, int x);

Note: NULL will be returned if x isn’t found.

strchr() source code example:

More »


Posted in C Reference string.h Functions | 1 Comment