473,484 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Reading a text file and storing the content in arrays in C++

1 New Member
Any help will be appreciated.

problem:

I have a text file which contains the following information

address name

202 blue ridge Mark Smith
156 Racoon Henry jones
............... ..................
etc.... etc..

there is no line breaks in the file

i need to read the file and store the address in array of addresses. also read the name and store it in array of names.

how do you you do that in C++
Sep 1 '06 #1
1 3241
f1engineer
5 New Member
It is necessary to have logical separator from the address and name. Example:

If each record is at the new line of the file, then You can read latest one, two or three words that are the name. All the previous words are the address:

London Berry streed 23 Michael Shumacher
London Berry streed 25 Andrew Smith Lawson

Another way is to separate the address and name in the file (if Your program generate this files) with double space, and when read data, reaching the place of of double space will be sign that the name is reached.

Best regards
Sep 1 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
7065
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
1
2658
by: Hayat | last post by:
Hello, I have a column (text datatype) and has to send an email as a text (not attachment) using cdonts. I am reading the data from text column storing in a varchar field and saying cdonts.body...
2
311
by: slickn_sly | last post by:
I'm trying to read a text file and storing each line to a specific array. so if i define an array - name, address,... and in my text file I have something like: John Doe Seattle, Washington ...
9
3581
by: Macca | last post by:
Hi, I have a synchronous socket server which my app uses to read data from clients. To test this I have a simulated client that sends 100 byte packets. I have set up the socket server so...
7
11761
by: ianenis.tiryaki | last post by:
well i got this assignment which i dont even have a clue what i am supposed to do. it is about reading me data from the file and load them into a parallel array here is the question: Step (1) ...
4
2186
by: nzjohnc | last post by:
Hi all, just started c ,need some help for storing values in arrays.I have opened the file for reading using fscanf,cos its got only three fields,but when i try to get the values to array,I'm...
21
3010
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z...
3
3151
by: jasvinder singh | last post by:
Respected Sir/madam, Can you help in providing code in 'C' for Reading text file with n number of rows and columns and putting the result in arrays.The sample file is as follows: rim_label =...
3
1229
by: electromania | last post by:
I'm trying to read from a text file. The format of the text file is 1999 78686 2000 78999 2001 80003 .................... .................... ................... 2002 ...
0
7082
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6953
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7144
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6813
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4845
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3046
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.