libcgi_general(3)

General purpose(3) Library Functions Manual General purpose(3)

NAME

General purpose -

Functions


char * htmlentities (const char *str)
Transforms HTML special chars. char ** file (const char *filename, unsigned int *total)
Reads entire file into an array. char * md5 (const char *str)
Converts a string to MD5 format.

Function Documentation

char** file (const char * filename, unsigned int * total)

Reads entire file into an array.Parameters:

filename Filename to open
total Integer variable passed as reference, which will store the total of items

Returns:

Returns the file in an array. Each element of the array corresponds to a line in the file.


char **lines;
unsigned int total, i;

lines = file('filename.ext', &total);

printf('Total of lines: %u0, total);

for (i = 0; i < total; i++)
printf('[%u] %s0, i, lines[i]);

for (i = 0; i < total; i++) {
if (lines[i])
free(lines[i]);
}

char* htmlentities (const char * str)

Transforms HTML special chars.Transforms chars like '<', '>' and others in HTML form, like '&lt' and '&gt'

Parameters:

str String containing code to parse

Returns:

The new string

Author:

Robert Csok <rcsok@gmx.de>

char* md5 (const char * str)

Converts a string to MD5 format.Author:

Diogo Gonzaga

Parameters:

str String to convert to MD5 hash

Returns:

MD5 hash code
13 Mar 2003 LibCGI