Menu

HelperUtilities

Brad Lanam

Wiki Home

Helper Utilities

These routines are written to work both on posix systems and on Windows.


mp4tag_fopen
FILE * mp4tag_fopen (const char *filename, const char *mode)

filename : The file to open.

mode : The mode to use to open the file (see fopen).

Returns: A FILE pointer or NULL on error.


mp4tag_file_size
ssize_t mp4tag_file_size (const char *filename)

filename : The file to open.

Returns: The size of the file or -1 on error.


mp4tag_read_file
char * mp4tag_read_file (const char *filename, size_t *sz, int *mp4error)

filename : The file to read.

sz : Returned size.

mp4error : Error return.

Returns: An allocated pointer to the data. The application takes ownership of the returned data and must free it.


mp4tag_file_delete
int mp4tag_file_delete (const char *filename)

filename : The file to delete.

Returns: 0 on success.


mp4tag_file_move

Renames a file.

int mp4tag_file_move (const char *filename, const char *nfn)

filename : The old filename.

nfn : The new filename.

Returns: 0 on success.


mp4tag_copy_file_times

Copies the file times (modification time, et. al) from one open file to another.

void mp4tag_copy_file_times (FILE *ifh, FILE *ofh)

ifh : FILE pointer to open source file.

ofh : FILE pointer to open target file.


mp4tag_ftell
int64_t mp4tag_ftell (FILE *fh)

fh : FILE pointer to open file


mp4tag_fseek
int mp4tag_fseek (FILE *fh, int64_t offset, int whence)

fh : FILE pointer to open file

offset : offset into file

whence : SEEK_SET, SEEK_END, SEEK_CUR


mp4tag_towide

Converts a utf8 string to Windows unicode.

wchar_t *mp4tag_towide (const char *buff)

buff : utf8 string

Returns: pointer to wchar_t

The caller takes ownership of the returned string and must free it.

mp4tag_fromwide

Converts a Windows unicode string to utf8.

char *mp4tag_fromwide (const wchar_t *buff)

buff : Windows unicode string

Returns: pointer to char

The caller takes ownership of the returned string and must free it.


Related

Wiki: Home