473,402 Members | 2,072 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,402 software developers and data experts.

Explanation of modifying data

6
Can anyone explain me what is the meaning of placing file pointer at the beginning of record to be modified while trying to modify data in files in c++
Jul 31 '17 #1
3 1620
weaknessforcats
9,208 Expert Mod 8TB
That pointer contains the address of where the file data is located.

If you don't know where the file is located, then how can you access the data?
Jul 31 '17 #2
donbock
2,426 Expert 2GB
How it works in C (presumably C++ is similar) ...

There are many files in your computer. Which file you are working with is controlled via a pointer to type FILE. This pointer gets its value from fopen() or freopen().

A file is made up of many bytes. Which byte you are currently working with is controlled by the stream position indicator - a secret pointer hidden in the FILE structure that you never access directly. It is initialized when you open the file; and advances as you read from or write to the file. You can also use fseek() to modify the stream position indicator.

Which kind of file pointer are you asking about?
Aug 1 '17 #3
donbock
2,426 Expert 2GB
Sounds like you want to modify a file.

Easiest way to do this is to read the entire input file into a memory buffer, modify the memory buffer as needed, and then write the buffer out to a new file (which might happen to have the same name as the input file).

You have to get clever if the input file doesn't fit in memory.
Aug 1 '17 #4

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

Similar topics

2
by: Danny | last post by:
I have a combo box look up and list items in a table, it is not bound. It works fine but how can I prevent the users from entering in there own data? i have an 'on change' event that when it...
2
by: chfran | last post by:
I have a form that has data behind it. The user can manipulate the data behind the form through the form and see how it affects the statistics of the data. The users want to be able to reset or...
1
by: Tarscher | last post by:
hi all, I have executed a query and put the result in a dataset. How can I get data from this dataset? Can I alter it directly or do I have to convert it into a new type to get the data from the...
1
by: Eagle | last post by:
I have a form that has one record with 22 fields. A grid is not the answer, either several small tables or combinations of textboxes and labels, so the user can edit all the editable fields then...
2
by: ads | last post by:
hi guys, Here's the scenario: i have a gridview on a parent page. Then i open another (child) page where i can modify the data on the dridview. How do i update the gridview soon as i do...
0
by: Steve Rainbird | last post by:
I am brand new to db2 so I may be doing something stupid here please excuse me if I am. I have downloaded and installed db2 9 express on my Windows xp system. I have created a table with 2...
3
by: tracethepath | last post by:
hello everybody... i am trying to make a project on binary files and that needs a function to modify data in a binary file. I have made the following class. class example { public: ...
10
by: giraffeboy | last post by:
Hi there, I'm having a problem with the Python db api, using MySQL. I've written a program with a GUI using wxPython, the GUI is contained in main.py which imports another module - reports.py....
5
by: bitbyte89 | last post by:
void modifyData() { int Id; char nm; float pay; fstream modData("Department1.txt",ios::out || ios::in || ios::binary); if(!modData) {
0
by: wa1gon | last post by:
Greetings, I am still trying to come up to speed with ADO.NET I have a simple form that I build with the IDE in design mode which created a DataSet, BindingSource, TableAdapter,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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
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...
0
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
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,...

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.