ayk
Ensign
- Registriert
- Apr. 2004
- Beiträge
- 163
Hi,
habe ein Problem mit einer DLL die ich erstellt habe. Wenn ich Funktion name() aufrufe, bekomme ich als Rückgabewert Zahlen wie: 19303060 oder 19300600. Sind das die Adressen zu dem String? Gibt es keine Möglichkeit den String als solches zurückzugeben?
habe ein Problem mit einer DLL die ich erstellt habe. Wenn ich Funktion name() aufrufe, bekomme ich als Rückgabewert Zahlen wie: 19303060 oder 19300600. Sind das die Adressen zu dem String? Gibt es keine Möglichkeit den String als solches zurückzugeben?
Code:
[SIZE=4][COLOR=#0000ff]char[/COLOR][/SIZE][SIZE=4]* n[] = {[/SIZE][SIZE=4][COLOR=#a31515]"Pablo "[/COLOR][/SIZE][SIZE=4], [/SIZE][SIZE=4][COLOR=#a31515]"Paige "[/COLOR][/SIZE][SIZE=4], [/SIZE][SIZE=4][COLOR=#a31515]"Pam "[/COLOR][/SIZE][SIZE=4], [/SIZE][SIZE=4][COLOR=#a31515]"Pamela "[/COLOR][/SIZE][SIZE=4], [/SIZE][SIZE=4][COLOR=#a31515]"Pandora "}[/COLOR][/SIZE]
[SIZE=4][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=4] random([/SIZE][SIZE=4][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=4] MinZahl,[/SIZE][SIZE=4][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=4] MaxZahl)[/SIZE]
[SIZE=4]{[/SIZE]
[SIZE=4][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=4] temp=0;[/SIZE]
[SIZE=4]srand(([/SIZE][SIZE=4][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=4])time(NULL)+clock());[/SIZE]
[SIZE=4][COLOR=#0000ff]do[/COLOR][/SIZE]
[SIZE=4]{[/SIZE]
[SIZE=4]temp=rand();[/SIZE]
[SIZE=4]}[/SIZE]
[SIZE=4][COLOR=#0000ff]while[/COLOR][/SIZE][SIZE=4](temp<MinZahl || temp>MaxZahl);[/SIZE]
[SIZE=4][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=4](temp);[/SIZE]
[SIZE=4]}[/SIZE]
[SIZE=4][COLOR=#0000ff]char[/COLOR][/SIZE][SIZE=4]* name([/SIZE][SIZE=4][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=4]){[/SIZE]
[SIZE=4][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=4] n[random(1,[/SIZE][SIZE=4][COLOR=#0000ff]sizeof[/COLOR][/SIZE][SIZE=4](n)/[/SIZE][SIZE=4][COLOR=#0000ff]sizeof[/COLOR][/SIZE][SIZE=4]([/SIZE][SIZE=4][COLOR=#0000ff]char[/COLOR][/SIZE][SIZE=4]*))-1];[/SIZE]
[SIZE=4]}[/SIZE]
Zuletzt bearbeitet: