Home Download Musics Developers
API Sources Tools File Format Technicals

Strings
[file68 library documentation.]


Detailed Description

Provides string manipulation functions.


Files

file  string68.h
 String header.


Functions

int SC68strcmp (const char *a, const char *b)
 Compare two string (case insensitive).

char * SC68strcat (char *a, const char *b, int l)
 Concatenate two strings.

char * SC68strdup (const char *s)
 Duplicate a string.

char * SC68strcatdup (const char *a, const char *b)
 Concat two strings in a duplicate buffer.

char * SC68time_str (char *buffer, int track_num, int seconds)
 Make a track and time information string.

char * SC68long_time_str (char *buffer, int time)
 Convert time (in second) to string.


Function Documentation

int SC68strcmp const char *  a,
const char *  b
 

Compare two string (case insensitive).

The SC68strcmp() function compares the two strings a and b, ignoring the case of the characters. It returns an integer less than, equal to, or greater than zero if a is found, respectively, to be less than, to match, or be greater than b.

Parameters:
a First string to compare
b String to compare with
Returns:
Integer result of the two string compare. The difference between last tested characters of a and b.
Return values:
0 a and b are equal
<0 a is less than b
>0 a is greater than b

char* SC68strcat char *  a,
const char *  b,
int  l
 

Concatenate two strings.

The SC68strcat() function appends the b string to the a string overwriting the 0 character at the end of dest, and then adds a terminating 0 character. The strings may not overlap. Destination string has a maximum size of l characters. On overflow, the trailing 0 is omitted.

Parameters:
a Destination string
b String to append.
l Destination maximum size (including trailing 0)
Returns:
Destination string
Return values:
a 

char* SC68strdup const char *  s  ) 
 

Duplicate a string.

The SC68strdup() function returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained with SC68alloc(), and can be freed with SC68free().

Parameters:
s String to duplicate.
Returns:
Duplicated string

0 error

char* SC68strcatdup const char *  a,
const char *  b
 

Concat two strings in a duplicate buffer.

The SC68strcatdup() function returns a pointer to a new string which is a duplicate of the string a+b. Memory for the new string is obtained with SC68alloc(), and can be freed with SC68free(). If either a or b is null the function does not failed but replace it by an empty string. If both a and b are null the function returns 0.

Parameters:
a Left string.
b right string.
Returns:
Duplicated string a+b

0 error

char* SC68time_str char *  buffer,
int  track_num,
int  seconds
 

Make a track and time information string.

The SC68time_str() function formats a string with track time info. The general format is "TK MN:SS" where:

  • TK is track_num or "--" if track_num < 0 or track_num > 99
  • MN:SS is time minutes and seconds or "--:--" if seconds < 0

Parameters:
buffer Destination buffer (0 use default static buffer).
track_num Track number from 00 to 99, minus values disable.
seconds Time to display in seconds [00..5999], other values disable.
Returns:
Pointer to result formatted string in a static buffer.
Warning:
The function returns a static buffer. Do try to modify it.

Not thread safe.

See also:
SC68utils_make_big_playing_time()

char* SC68long_time_str char *  buffer,
int  time
 

Convert time (in second) to string.

The SC68long_time_str() function converts a time in seconds to days, hours, minutes and second string. Day and hour unit are removed if they are null (not signifiant). The output string looks like : [D days, ][H h, ] MN' SS"

Parameters:
buffer Destination buffer (0 use default static buffer).
time Time in second to convert to string.
Returns:
pointer to result time string (given buffer or static buffer).
Warning:
Not thread safe when using static buffer.
See also:
SC68utils_make_track_time_info()