473,799 Members | 3,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3617
asn says:
Is it possible to read data from these two files simultaneously using
file stream concepts?

what do you mean by "simultaneo usly 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
5580
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 the first aren't updated? I usually just close all the files, and restart IDLE, but this is a pain. Maybe because I always use right click -> edit with IDLE (on Windows). That starts up a separate Python Shell too, which I always close. MB
4
7575
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 subsequently be viewed on the site's pages. My hosting provider is requiring that any files my Web app writes get written to a folder that is above the app's root folder (for security purposes). When writing the files I understand how to use MapPath to...
14
2492
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 transferred our site www.orbisoft.com to a new W2003 IIS6 server they set up. That was a week ago. Since that transfer, all of our ASPX pages that use Access2000 databases have stopped working.
6
11563
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 I have no idea how to do something like this with VB.Net. Has anyone done something like this or know where I can find out information how to perform the process of signing a document when sending it then checking one on receipt? Your help is...
4
2101
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, and I get compile errors. I'm currently using the following *.bat file http://axter.com/complr.bat With the following simple hello world source code: http://axter.com/helloworld.cpp
1
1590
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 folder, but this leaves the question: why didn't it work in the first place? It was driving me nuts, and I'd still like to know why. My settings before I dragged over the file: XP Pro SP2 Latest PHP installed in "C:\Program Files\php"
0
1585
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 virtual memory (subset relationship). But the following simple code on Windows Server 2003 proves (if you monitor virtual bytes counter and working set bytes conuter from perfmon), if we do not unmap the page map file, the working set will continue to...
5
10505
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 files. Any help. -- Jerry
3
1651
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 did find that some of the disco/wsdl files referenced the wrong webservice website, and I changed them, but no webservices for this application work on that server I went to the webserver itself, and put in the localhost/path/whatever.asmx...
6
7602
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 work. Please review my work and let me know if you see that one little thing that is throwing me for a loop. HTTPD.CONF # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the...
0
9686
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10475
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10026
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.