473,473 Members | 4,189 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

do we need to release the ifstream object explicitly?

bajajv
152 New Member
Hi,
How to release an ifstream or ofstream object before it goes out of scope?
Dec 29 '07 #1
1 1521
weaknessforcats
9,208 Recognized Expert Moderator Expert
You can delete any object if you have created it on the heap. Otherwise,.it is an automatic variable and the compiler will take care of it.

In fact, that is the whole point of heap vs stack: Are you in charge of the object or is the compiler??
Dec 29 '07 #2

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

Similar topics

6
by: csvka | last post by:
Hello, I wonder if I could pick your brains. I'm beginning to learn about C++. I have opened a file in my program and I want to read lines from it. I would like this to be done in a separate...
0
by: gchandran | last post by:
Hi All, Problem: Call to DOMDocument::getElementsByTagName() in a loop causes growth in memory consumption? Consider the following lines of code which simulates the problem that I am facing....
0
by: Onur Buyukcaglar | last post by:
Hi, After reading and applying the following sample/example from Charles Law, who responded Vibhu Bansal's "createDocumentFromUrl usage in VB.NET / loading a url using mshtml.createDocumentFromUrl...
4
by: Paul H | last post by:
A typical chunk of code...... Set db = CurrentDb Set rs = db.OpenRecordset("tblFoo") <Do some stuff here> 'How much of the stuff below do I need? 'Do I need to close the recordset?...
2
by: Alex K. | last post by:
Hi all In following code, is it OK not to dispose local brush explicitly before exiting the procedure? private void MyDrawItem ( Graphics g, Color BackColor, Rectangle r ) {...
0
by: richsonn | last post by:
We are using an out-of-process COM object--created with HttpContext.Current.Server.CreateObject("Class.object")--in an VB/ASP.NET 1.x application. The COM object releases a-ok when we use...
7
by: Raymond Chiu | last post by:
Dear all, I have written the following code in the button click event but find that excel session object always remain in the server as seen from taskmanager. Do you know why?...
1
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I have a Activex control in the asp.net page. When it is used, when the Activex object will be released? If the Activex object is used in a popup window, when the window is closed will the...
2
by: Ciprian Tomoiag | last post by:
Hello. I need to open multiple (text) files one by one and I thought to generate their names and use the streams to read from them. const char* FIN = FileName.c_str(); ifstream fin(FIN, ios::in...
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...
1
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
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.