Re: Untagged Arrays

From: Juan Antonio Ortega Lalmolda <"Juan>
Date: Tue, 20 May 2003 17:58:31 +0200

----boundary-LibPST-iamunique-379732697_-_-
Content-type: text/plain

Hello Gerhard,

I get the same result with both procedures (User Name Error message).
You have to initialize the variable size with the length of the array.
Adding size := 40 after str:="", solves the problem.

Regards,
Juan Antonio

----- Original Message -----
From: <Gerhard.Marent{([at]})nowhere.xy
To: <blackbox{([at]})nowhere.xy
Sent: Tuesday, May 20, 2003 4:34 PM
Subject: Untagged Arrays


Hello Blackbox Users,

when I tried to use WinApi.GetUsername I found a strange behavior which I
can not explain.

The two versions of Procedure Run of the module TestWin differ only in a
superfluous local
variable h: SHORTINT in the second version but the result is different.

I suppose that the effect comes from the untagged array in the WinApi
procedure which I don't
use the right way. But what would be correct?

For your help, thanks in advance.

Gerhard Marent

E-Mail: gerhard.marent{([at]})nowhere.xy




MODULE TestWin;

IMPORT SYSTEM, Strings, WinApi, Out, Dialog;


PROCEDURE Run1*;
VAR str0: ARRAY [untagged] 40 OF SHORTCHAR; str: Dialog.String; size, i:
INTEGER;
BEGIN
str0 := "";
IF WinApi.GetUserName (str0, size) # 0 THEN
FOR i := 0 TO size DO str[i] := LONG(str0[i]); END;
Out.String(str); Out.Ln;
ELSE
Dialog.Beep; Dialog.ShowMsg("User Name Error");
END;
END Run1;

PROCEDURE Run2*;
VAR str0: ARRAY [untagged] 40 OF SHORTCHAR; str: Dialog.String; h: SHORTINT;
size, i: INTEGER;
BEGIN
str0 := "";
IF WinApi.GetUserName (str0, size) # 0 THEN
FOR i := 0 TO size DO str[i] := LONG(str0[i]); END;
Out.String(str); Out.Ln;
ELSE
Dialog.Beep; Dialog.ShowMsg("User Name Error");
END;
END Run2;

END TestWin.
--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word
"unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send
a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list
owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to
the mailing list. That way, the list server will recognize you as subscriber
and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are
subscribed, your message will be moderated to avoid spam. Please understand
that moderation will often cause some delay, in particular over weekends or
holydays.

--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.


----boundary-LibPST-iamunique-379732697_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhlbGxvIEdlcmhhcmQsXHBhcg0KXHBhcg0KSSBn
ZXQgdGhlIHNhbWUgcmVzdWx0IHdpdGggYm90aCBwcm9jZWR1cmVzIChVc2VyIE5hbWUgRXJyb3Ig
bWVzc2FnZSkuXHBhcg0KWW91IGhhdmUgdG8gaW5pdGlhbGl6ZSB0aGUgd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iIHRvIHRoZSBhYm92
ZSBhZGRyZXNzLlxwYXINClxwYXINClNlbmQgYW55IHByb2JsZW0gcmVwb3J0cyBvciBxdWVzdGlv
bnMgcmVsYXRlZCB0byB0aGlzIGVtYWlsIGxpc3QgdG8gdGhlIGxpc3Qgb3duZXIgYXRccGFyDQog
ICBvd25lci1ibGFja2JveEBvYmVyb24uY2hccGFyDQpccGFyDQpDdXJyZW50IHBvc3RpbmcgcG9s
aWN5OlxwYXINClxwYXINCmEpIFRvIHBvc3QgeW91IHNob3VsZCB1c2UgdGhlIHNhbWUgYWRkcmVz
cyBieSB3aGljaCB5b3UgYXJlIHN1YnNjcmliZWQgdG8gdGhlIG1haWxpbmcgbGlzdC4gVGhhdCB3
YXksIHRoZSBsaXN0IHNlcnZlciB3aWxsIHJlY29nbml6ZSB5b3UgYXMgc3Vic2NyaWJlciBhbmQg
Zm9yd2FyZCB5b3VyIHBvc3RpbmcgaW1tZWRpYXRlbHksIHdpdGhvdXQgY3JlYXRpbmcgYW55IG92
ZXJoZWFkLlxwYXINClxwYXINCmIpIElmLCBmb3Igc29tZSByZWFzb24sIHlvdSBjYW5ub3QgcG9z
dCBmcm9tIHRoZSBhZGRyZXNzLCBieSB3aGljaCB5b3UgYXJlIHN1YnNjcmliZWQsIHlvdXIgbWVz
c2FnZSB3aWxsIGJlIG1vZGVyYXRlZCB0byBhdm9pZCBzcGFtLiBQbGVhc2UgdW5kZXJzdGFuZCB0
aGF0IG1vZGVyYXRpb24gd2lsbCBvZnRlbiBjYXVzZSBzb21lIGRlbGF5LCBpbiBwYXJ0aWN1bGFy
IG92ZXIgd2Vla2VuZHMgb3IgfX0AIHN1YnNjcmliZWQsIA==


----boundary-LibPST-iamunique-379732697_-_---
Received on Tue May 20 2003 - 17:58:31 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:14 UTC