Vorheriges Thema: GetMIFComponent oder GetComponent - Abrufen des KomponentennamensNächstes Thema: GetMIFString - Abrufen des Wertes eines Zeichenfolgenattributs


GetMIFInteger - Abrufen des Wertes eines Ganzzahlattributs

Gültig für UNIX und Windows.

"GetMIFInteger" ruft den Wert eines bestimmten Ganzzahlattributs aus einer MIF-Datei ab.

Diese MIF- und INV-Dateifunktion hat das folgende Format:

GetMIFInteger(Filename as string, GroupName as string, AttrName as string) as integer
GetMIFInteger(Filename as string, GroupID as integer, AttrID as integer) as integer
GetMIFInteger(Filename as string, GroupName as string, GroupID as integer, AttrName as string, AttrID as integer) as integer
Filename

Der Dateiname der MIF-Datei.

GroupName

Gibt den Namen der Gruppe an, in der das Attribut gespeichert ist.

GroupID

Gibt die ID der Gruppe an, in der das Attribut gespeichert ist.

AttrName

Gibt den Namen des Attributs an, von dem der Wert abgerufen wird.

AttrID

Gibt die ID des Attributs an, von dem der Wert abgerufen wird.

Wenn das angegebene Attribut in der MIF-Datei gefunden wird, gibt die Funktion "GetMIFInteger" den Wert des Ganzzahlattributs zurück, andernfalls wird 0 zurückgegeben.

Beispiel: Funktion "GetMIFInteger"

Dies ist ein Beispiel für die Funktionen "GetMIFComponent", "GetMIFInteger", "GetMIFString", "GetMIFValue" und "SetMIFValue".

Dim file, gname, aname as string
Dim gid as integer

ClrScr()
file = "h:\test\miffus\file.mif"

Print("Component of """ + file + """: """ + GetMIFComponent(file) + """")

gname = "Strings"
gId = 1
aname = "string_1"
Print(gname + "." + aname + " = " + GetMIFString(file, gname, gId, aname, 1))
aname = "string_2"
Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))

if SetMIFValue(file, gname, gId, aname, 2, "Text_new") then
	Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
else
	Print("1. SetMIFValue failed.")
	exit
endif

gname = "Numbers"
gId = 2
aname = "number_1"
Print(gname + "." + aname + " = " + Str(GetMIFInteger(file, gname, gId, aname, 1)))
aname = "number_2"
Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
if SetMIFValue(file, gname, gId, aname, 2, "999999") then

Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
else
	Print("2. SetMIFValue failed.")
	exit
endif