Re: AW: [Dev-C++] Strange phenomenon
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2002-10-24 12:32:42
|
Do you need to use BYTE? you seem to be typecasting a lot.
You've allocated memory with new
BYTE *CalledPartyNumberStruct = new BYTE[1024];
then used malloc to allocate more memory later, why is that?
>From: Christian Wallukat <Chr...@vo...>
>To: Daniel Glenfield <sp...@ho...>,
>dev...@li...
>Subject: AW: [Dev-C++] Strange phenomenon
>Date: Thu, 24 Oct 2002 14:18:29 +0200
>
>unsigned Connect(char CalledPartyNumber[1024], char
>CallingPartyNumber[1024])
>{
> _cmsg CMSG;
> int error;
> long Controller;
> unsigned short CIPValue;
>
>
>
> Controller = GetFreeController();
> if (Controller == -1)
> {
> /*----- if no available controller use the first one for
>correct -----*/
> /*----- error signaling -----*/
> Controller = 1;
> };
>
> int Connection = GetFreeLine();
>
> if (Connection == -1)
> {
> printf("Error: no available connection identifiers\n");
> /*----- no OS resources -----*/
> return 0x1108;
> };
>
>
>
> /*----- use ConnectionIdentifier as Messagenumber -----*/
> CONNECT_REQ_HEADER(&CMSG, (WORD)dwApplID, (unsigned short)Connection,
>Controller);
>
> /*----- build up service mask -----*/
>
> CONNECT_REQ_CIPVALUE(&CMSG) = 0x1;
>
> CONNECT_REQ_CALLEDPARTYNUMBER(&CMSG) = SetNumber
>(CalledPartyNumber);;
> CONNECT_REQ_CALLINGPARTYNUMBER(&CMSG) = SetNumber
>(CallingPartyNumber);
> CONNECT_REQ_B1PROTOCOL(&CMSG) = B1PROTOCOL;
> CONNECT_REQ_B2PROTOCOL(&CMSG) = B2PROTOCOL;
> CONNECT_REQ_B3PROTOCOL(&CMSG) = B3PROTOCOL;
> CONNECT_REQ_B3CONFIGURATION(&CMSG) = B3CONFIGURATION;
>
>
> return error;
>};
>
>
>
>
>
>
>
>
>BYTE *SetNumber(char Number[1024])
>{
> BYTE *CalledPartyNumberStruct = new BYTE[1024];
>
> if (strlen(Number) >= 1)
> {
> int len;
>
> len = strlen(Number);
>
> /*----- \xLen\x80 STRING '\0' -----*/
>
> CalledPartyNumberStruct = (unsigned char *)malloc(len + 2 +
>1);
>
> CalledPartyNumberStruct[0] = (unsigned char)(len + 1);
> CalledPartyNumberStruct[1] = 0x80;
>
> strcpy ((char *)&(CalledPartyNumberStruct[2]), Number);
> };
>
> return CalledPartyNumberStruct;
>};
>
>-----Ursprüngliche Nachricht-----
>Von: Daniel Glenfield [mailto:sp...@ho...]
>Gesendet am: Donnerstag, 24. Oktober 2002 14:14
>An: Chr...@vo...; dev...@li...
>Betreff: Re: [Dev-C++] Strange phenomenon
>
>Could be a scope problem. You'll need to show us the functions.
>
>
> >From: Christian Wallukat <Chr...@vo...>
> >To: "Dev-Cpp-Users@Lists. Sourceforge. Net (E-Mail)"
> ><dev...@li...>
> >Subject: [Dev-C++] Strange phenomenon
> >Date: Thu, 24 Oct 2002 13:51:23 +0200
> >
> >Hi List,
> >
> >
> >i have a strange phenomenon in my project:
> >
> >I call a function: Test(char szTest[1024]) with Test("test");
> >
> >In that function another Function (like the first) will be called:
> >Test2(szTest);
> >
> >the adress of szZest is 0x000000000....
> >
> >and the content is empty ....
> >
> >
> >Anyone an Idea ????
> >
> >Kind r
> >
> >Chris
> >
> >
> >-------------------------------------------------------
> >This sf.net email is sponsored by: Influence the future
> >of Java(TM) technology. Join the Java Community
> >Process(SM) (JCP(SM)) program now.
> >http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote
> >_______________________________________________
> >Dev-cpp-users mailing list
> >Dev...@li...
> >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>_________________________________________________________________
>Get a speedy connection with MSN Broadband. Join now!
>http://resourcecenter.msn.com/access/plans/freeactivation.asp
_________________________________________________________________
Internet access plans that fit your lifestyle -- join MSN.
http://resourcecenter.msn.com/access/plans/default.asp
|