1General purpose(3)         Library Functions Manual         General purpose(3)
2
3
4

NAME

6       General purpose -
7
8   Functions
9       char * htmlentities (const char *str)
10           Transforms HTML special chars.
11       char ** file (const char *filename, unsigned int *total)
12           Reads entire file into an array.
13       char * md5 (const char *str)
14           Converts a string to MD5 format.
15

Function Documentation

17   char** file (const char * filename, unsigned int * total)
18       Reads entire file into an array.Parameters:
19           filename Filename to open
20           total Integer variable passed as reference, which will store the
21           total of items
22
23       Returns:
24           Returns the file in an array. Each element of the array corresponds
25           to a line in the file.
26
27        char **lines;
28        unsigned int total, i;
29
30        lines = file('filename.ext', &total);
31
32        printf('Total of lines: %u0, total);
33
34        for (i = 0; i < total; i++)
35               printf('[%u] %s0, i, lines[i]);
36
37        for (i = 0; i < total; i++) {
38               if (lines[i])
39                        free(lines[i]);
40        }
41
42
43   char* htmlentities (const char * str)
44       Transforms HTML special chars.Transforms chars like '<', '>' and others
45       in HTML form, like '&lt' and '&gt'
46
47       Parameters:
48           str String containing code to parse
49
50       Returns:
51           The new string
52
53       Author:
54           Robert Csok <rcsok@gmx.de>
55
56   char* md5 (const char * str)
57       Converts a string to MD5 format.Author:
58           Diogo Gonzaga
59
60       Parameters:
61           str String to convert to MD5 hash
62
63       Returns:
64           MD5 hash code
65
66LibCGI                            13 Mar 2003               General purpose(3)
Impressum