473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

which data structure can I use?


Hi,

I am getting data from a server over the network using a HTTP request
The data comes in chunks that I currently appending to a file I have
opened earler for read. Later I read it out line by line from this file
using the getline function.
I have no means of knowing how big the data will be beforehand. But, I
was to use an in memory data structure instead of the file that will
let the read the data out line by line, exactly as I did wth the file.
Can someone help me with this? A char array wouldnt work as how do I
get the data out line by line? Thats absolutely essential to me,

Thanks,
Carmen

Jul 23 '05 #1
2 1256
ve***********@yahoo.com wrote:
Hi,

I am getting data from a server over the network using a HTTP request
The data comes in chunks that I currently appending to a file I have
opened earler for read. Later I read it out line by line from this file
using the getline function.
I have no means of knowing how big the data will be beforehand. But, I
was to use an in memory data structure instead of the file that will
let the read the data out line by line, exactly as I did wth the file.
Can someone help me with this? A char array wouldnt work as how do I
get the data out line by line? Thats absolutely essential to me,

Thanks,
Carmen


Use a stringstream, ostringstream, or istringstream. They are declared
in the standard header <sstream>, and work essentially like fstream,
ofstream, and ifstream, respectively.

-Alan
Jul 23 '05 #2
On Wed, 15 Jun 2005 11:12:10 +0400, <ve***********@yahoo.com> wrote:

I am getting data from a server over the network using a HTTP request
The data comes in chunks that I currently appending to a file I have
opened earler for read. Later I read it out line by line from this file
using the getline function.
I have no means of knowing how big the data will be beforehand. But, I
was to use an in memory data structure instead of the file that will
let the read the data out line by line, exactly as I did wth the file.
Can someone help me with this? A char array wouldnt work as how do I
get the data out line by line? Thats absolutely essential to me,


Just search the array for "\r\n" which designates the end of line.

You could also take a look at libevent library that has a buffer data
structure which takes the burden of reading a socket/file off you and
allows you to extract lines easily.

--
Maxim Yegorushkin
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
1
by: Julia Jin | last post by:
Hi, there, I have a list of elements. Each time when a new data comes in, I need to check if the new data exists in the list. If not exists, I need to insert the new data into the list. If I...
27
by: Sune | last post by:
Hi! Pre-requisites: ------------------- 1) Consider I'm about to write a quite large program. Say 500 K lines. 2) Part of this code will consist of 50 structs with, say, no more than at most...
3
by: Kiran B. | last post by:
Hi, I am new to .net. I have two Data Structure Type ... Sturcture A and Structure B. Structure A Public Fname as String Public LastName as String Public City as String Public Zip as String...
15
by: Rob Meade | last post by:
Hi all, I have a databse which I'm pulling the data from for my ASP page. I have 4 tables, Course, Feature, Objective, and PreRequisite. The last three all contain a course product code and a...
4
by: sakcee | last post by:
Hi I hope that I can learn from your experience . I want to know if you have seen a perticular problem and used a perticular data structure , and why? I usually end up using just arrays,...
3
by: JJ | last post by:
I've got an n-layer application that fetches data from an SQL database using stored procedures. This information is read into various classes which represent a hierachical structure:. eg. ...
2
by: sharan | last post by:
Hello Friends I have a problem in Data Structure (In C) i want to emplement a General tree having three child nodes of each parent node ...please send me any simple Example( code) by which i can...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.