473,378 Members | 1,369 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,378 software developers and data experts.

Working with files in C

asn
Example :
If i store details of Employee no and name in a text file and the
employee salaries in another.
Is it possible to read data from these two files simultaneously using
file stream concepts?
If so, can anyone help me with an example.

Nov 15 '05 #1
6 3600
asn says:
Is it possible to read data from these two files simultaneously using
file stream concepts?

what do you mean by "simultaneously using file stream concepts"?

Nov 15 '05 #2
asn wrote:
Example :
If i store details of Employee no and name in a text file and the
employee salaries in another.
Is it possible to read data from these two files simultaneously using
file stream concepts?
Depends on your concept of simultaneously.
You can open two streams and read alternately from both as needed.

If so, can anyone help me with an example.


This sounds like a homework question, so: sorry, I won't.

Bring your best shot at the solution, tell us what problems you
have with it. Then you will get help.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #3
"asn" <br***************@gmail.com> wrote:
# Example :
# If i store details of Employee no and name in a text file and the
# employee salaries in another.
# Is it possible to read data from these two files simultaneously using
# file stream concepts?
# If so, can anyone help me with an example.

You can have some number of simultaneously open files. I've seen
minimums of 20 and maximums of tens of thousands, depending on the
system. Each open file maintains its own file position; on a seekable
device (disk files are seekable on all rational systems) you can
move forward and backwards with fseek and related functions.

So, yes, you can read a primary file line by line, parsing the line
into fields. Then as you read and parse that file, you can position
the secondary file and join to the line with the matching key, reading
and parsing that line.

You can position the second by rewinding and then reading each line
up to the match. Or if you have additional information about, such
as it is always sorted on its search key, you can search it more
efficiently. You can also scan the file once on open and use ftell
or fgetpos to build up and internal index of the file. Subsequently
you can fseek or fsetpos directly to the line with the key.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
You hate people.
But I love gatherings. Isn't it ironic.
Nov 15 '05 #4
asn
Thanks Michael

Nov 15 '05 #5
asn
Thanks for your explanation Ryan

Nov 15 '05 #6
asn
Thanks for your explanation Ryan

Nov 15 '05 #7

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

Similar topics

1
by: Moosebumps | last post by:
So say I am working on two separate .py files in IDLE that are part of the same program. Does anyone have problems where when you modify one file, and then run the other, the changes you made in...
4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
14
by: Mark B | last post by:
Our webhost (www.usbusinessweb.net) had a W2K IIS5 server crash after a scheduled hard-boot occurred during a ms-security patch install overnight. They couldn't get the server working again so they...
6
by: Matt Frame | last post by:
I have a client that has asked us to get a digital signature certificate and start digitally signing all files we pass between each other. I have heard of the subject and know about the certs but...
4
by: Axter | last post by:
Sorry for OT question, but does any one have a working *.bat file to get Comeau to work with VC++ 7.1, VC++ 8.0, or GNU 3.x compilers. I've tried everything I can think off, to get it to work,...
1
by: saturday | last post by:
I was having problems getting mysql to work with php on my apache server. Thankfully I got it working after reading a different thread, which had me copy over the libmysql file to the apache/bin...
0
by: George2 | last post by:
Hello everyone, From the definition of working set, it is a subset of virtual pages resident in physical memory -- from book Windows Internals. It means working set could not be larger than...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine running IIS 6.0. I just replaced the web.config and several aspx pages in the application and now the style sheets are not working. the images from the themes work but not the css...
3
by: Seth Williams | last post by:
I have done some new development on older files, locally - then I copy the files, along with the .vb files for the webservices, to our DEV server. Now, mysteriously, no web services are running - I...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.