View previous topic :: View next topic |
Author |
Message |
sohailkhanonline
Joined: 06 Mar 2008 Posts: 35 Location: pakistan
|
Large array problem |
Posted: Mon Apr 28, 2008 3:05 am |
|
|
Hi following is my hardware info
Code: | #include <18F4620.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP, NODEBUG
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
the application is connected to ethernet and i want to recieve this string in array
Code: | HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Mon, 28 Apr 2008 08:50:23 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: ASP.NET_SessionId=pzvtzcrlvwydngr2ga1jsymm; path=/; HttpOnly
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 357
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetTimeResponse xmlns="http://tempuri.org/"><GetTimeResult>Please Call Again</GetTimeResult></GetTimeResponse></soap:Body></soap:Envelope> |
If i declare array of sufficient length like
800 or 900 or even 1200 following is the part of data that is saved in array
Code: | soap:Body><GetTimeResponse xmlns="http://tempuri.org/"><GetTimeResult>Please Call Again</GetTimeResult></GetTimeResponse></soap:Body></soap:Envelope>
|
Following is the code for declaring this array
Code: | char keydata[900];
int indextodata;
char c;
TCPSocket socket;
while (TCPGet(socket, &c))
{
keydata[indextodata]=c;
indextodata++;
printf("%c",c);
} |
How can i get the whole data in one string
Thanks _________________ sohail khan |
|
![](templates/subSilver/images/spacer.gif) |
sohailkhanonline
Joined: 06 Mar 2008 Posts: 35 Location: pakistan
|
SOLVED |
Posted: Mon Apr 28, 2008 5:50 am |
|
|
when i declare the index variable as
static unsigned int16 index;
the index was having an overflow.
everything worked fine.. _________________ sohail khan |
|
![](templates/subSilver/images/spacer.gif) |
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Mon Apr 28, 2008 6:20 am |
|
|
That is because an int is only 8 bit.
int = UInt8 (0 to 255) |
|
![](templates/subSilver/images/spacer.gif) |
|