CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Large array problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sohailkhanonline



Joined: 06 Mar 2008
Posts: 35
Location: pakistan

View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger

Large array problem
PostPosted: Mon Apr 28, 2008 3:05 am     Reply with quote

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
sohailkhanonline



Joined: 06 Mar 2008
Posts: 35
Location: pakistan

View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger

SOLVED
PostPosted: Mon Apr 28, 2008 5:50 am     Reply with quote

when i declare the index variable as
static unsigned int16 index;
the index was having an overflow.
everything worked fine..
_________________
sohail khan
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Mon Apr 28, 2008 6:20 am     Reply with quote

That is because an int is only 8 bit.

int = UInt8 (0 to 255)
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group