>static Boolean Get_Buffer_Data (unsigned char buffer_num,unsigned int
num_bytes , void * buf )
The pointer passed as buf must point to memory, not just another pointer.
Good:
char MyBuffer[128];
Get_Buffer_Data(x,127,MyBuffer);
Bad:
char *MyBuffer;
Get_Buffer_Data(x,127,MyBuffer);
If buf points to a pointer without enough memory allocated, the best you
could hope for is strange results, the worse would be a program that crashes
constantly.
-----Original Message-----
From: Allen Yang <[EMAIL PROTECTED]>
To: '[EMAIL PROTECTED]' <[EMAIL PROTECTED]>
Date: Friday, August 27, 1999 10:36 AM
Subject: RE: Please help with serial communication
>Hi,Dave:
>Thank you for your email. I am not sure how to find the memory? Would you
>mind explain to me more?
>
>Thank you.
>
>Allen
>
>-----Original Message-----
>From: Dave Lippincott [mailto:[EMAIL PROTECTED]]
>Sent: Friday, August 27, 1999 9:03 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Please help with serial communication
>
>
>Another thing to look at: you buffer variable...where are you allocating
>memory for it? The buffer is not allocated memory by SerReceive.
>
>-----Original Message-----
>From: Allen Yang <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>Date: Thursday, August 26, 1999 8:18 PM
>Subject: Please help with serial communication
>
>
>>Hi,
>>I tried to get some data from PC. And my code just won't work. anyone can
>>help me with it?
>>
>>static void do_channel()
>>{
>> Err serror;
>>// unsigned int x;
>> unsigned char COMM_REQUEST;
>> unsigned char SAMPLE_READY_FLAG;
>> UInt temp = 0;
>>
>> for (temp = 0; temp<2; temp++)
>> {
>>
>> if (temp == 0) {
>> Get_Buffer_Data(1,25,x); // this is the function for
>>getting data
>> SAMPLE_READY_FLAG = 0;
>> SerReceiveFlush(serial_lib,0);
>> }
>> else
>> Get_Buffer_Data(1,25,x);
>>
>> }
>>}
>>
>>static Boolean Get_Buffer_Data (unsigned char buffer_num,unsigned int
>>num_bytes , void * buf )
>>{
>> Err serror;
>> unsigned char buffer_sent;
>> char* bufchar;
>> num_bytes = 25;s
>>
>>
>>
>> SerReceive(serial_lib,buf,num_bytes,SERIAL_TIMEOUT,&serror);
>> SAMPLE_READY_FLAG = 1;
>>
>> bufchar=buf;
>>
>> StrPrintF(reading_buf,bufchar);
>> fieldptr_ldu_ch3v = FrmGetObjectPtr(FrmGetActiveForm(),
>>FrmGetObjectIndex(FrmGetActiveForm(), fieldID_ldu_ch3v));
>> FldSetTextPtr(fieldptr_ldu_ch3v, reading_buf);
>> FldRecalculateField(fieldptr_ldu_ch3v, true);
>>
>> return 1;
>>}
>>
>>I really don't know what is wrong with my code, and what is the problem ?
>>
>>Please help me out.
>>
>>Thanks ad advance.
>>
>>Allen
>>
>
>
>