All pastes #412899 Raw Edit

YSI_INI.own

public cpp v1 · immutable
#412899 ·published 2007-03-28 00:44 UTC
rendered paste body
/*----------------------------------------------------------------------------*-YAdmin system - INI CoreReads the INI and also exports a number of functions to other "classes" foreasy reading of data files thereChangelog:24/03/07:First version.-*----------------------------------------------------------------------------*/#define MAX_INI_TAG 16/*----------------------------------------------------------------------------*-Function:	INI_INIParams:	-Return:	-Notes:	--*----------------------------------------------------------------------------*/stock INI_INI() {}/*----------------------------------------------------------------------------*-Function:	INI_GetTagNameParams:	source - The string you want to get a tag from.	dest - The place you want to store the tag toReturn:	bool: Found the tag correctly.Notes:	--*----------------------------------------------------------------------------*/bool:INI_GetTagName(source[], dest[]){	if (source[0] != '[') return false;	new		len = chrfind(']', source);	if (len == -1) return false;	strcpy(dest, source[1], len - 1);	return true;}/*----------------------------------------------------------------------------*-Function:	INI_GetEntryNameParams:	source - The string you want to get an entry name from.	dest - The place you want to store the entry name toReturn:	bool: Found the name correctly.Notes:	--*----------------------------------------------------------------------------*/bool:INI_GetEntryName(source[], dest[]){	new		i;	while (source[i] > ' ' && source[i] != '=') i++;	if (!i) return false;	strcpy(dest, source, i);	return true;}/*----------------------------------------------------------------------------*-Function:	INI_GetEntryTextParams:	source - The string you want to get an entry from.	dest - The place you want to store the entry toReturn:	bool: Found the entry correctly.Notes:	--*----------------------------------------------------------------------------*/bool:INI_GetEntryText(source[], dest[]){	new		i;	while (source[i] > ' ' && source[i] != '=') i++;	while (source[i] && (source[i] <= ' ' || source[i] == '=')) i++;	if (!source[i]) return false;	strcpy(dest, source[i], strlen(source) - i);	return true;}