DataContainers ›› HashTable ›› CreateHashTable

プログラム言語 FreeBasic


CreateHashTable

構文

Function CreateHashTable() As Any Ptr

説明

新しいハッシュテーブルを作成し、そのハンドルを返します。

文字列データにハッシュテーブルを使う場合は、SetValueStrHashTable 関数と GetValueStrHashTable 関数を使います。

FreeHashTable、FreeKeyHashTable、DeleteHashTable 関数は、文字列データメモリを解放するために、最後のパラメータにゼロ以外の値を含める必要があります。
ハッシュテーブルに文字列以外のデータが含まれている場合は、SetValueHashTable、GetValueHashTable 関数を使います。

FreeHashTable、FreeKeyHashTable、DeleteHashTable 関数は、最後のパラメーターにゼロ(デフォルト)を含める必要があります。

同じハッシュテーブルに文字列関数と非文字列関数を混在させることは望ましくありません。

オプション

無し

プラットホーム

Windows , Linux


#include "window9.bi"

dim p as any ptr = CreateHashTable()

For i As Long = 0 To 10

    dim as string skey = "Key" & i

    dim as USTRING us = str(rnd)

    SetValueStrHashTable(p , skey , us)

Next

For i As Long = 0 To 10

    dim as string skey = "Key" & i

    ? GetValueStrHashTable(p , skey )

Next

DeleteHashTable(p , 1)

Sleep

結果

0.3300995409954339
0.3290384791325778
0.5324827746953815
0.7599449595436454
0.6424803049303591
0.6527107947040349
0.2956116099376231
0.970114589901641
0.9696021103300154
0.9504357760306448
0.5354314723517746


http://mneniya.ucoz.ru/

←リンク元に戻る Window9 トップに戻る FreeBASIC マニュアル トップに戻る
ロシア語オリジナル:https://users.freebasic-portal.de/freebasicru/window9lib/window9.html