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

How do i open any existing file in VC++ without losing its contents

Lemme explain exactly what am doing. Its pretty simple.

String^ file_name = "c:\\test.txt";
StreamWriter^ sw = gcnew StreamWriter(file_name);
sw->WriteLine("Hello");

When I do this, everytime I run this program, the existing file is opened by erasing its contents. How can I avoid this, so that I can append this new text to EOF (End Of File) everytime?
Sep 27 '08 #1
1 1351
Banfa
9,065 Expert Mod 8TB
Use the StreamWriter Constructor (String, Boolean)rather than the StreamWriter Constructor (String).

Look up the StreamWriter class on MSDN, Google is your friend.
Sep 27 '08 #2

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

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
6
by: Colleyville Alan | last post by:
I seem to recall reading somewhere that there was a keyword that allowed a variable to have data added to it without losing its contents. a = "Hi " and b = "There" myvar = a myvar = b the...
1
by: wayne | last post by:
Dear all, may i know how can i delete the contents of an existing file using vc++?? also, i would like to know how can i delete the whole file? thanks alot wayne
0
by: wayne | last post by:
thanks Carl Daniel. :D Carl Daniel wrote: > *wayne wrote: > > Dear all, > > > > may i know how can i delete the contents of an existing file using > > vc++?? also, i would like to know how...
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?
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...
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
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
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
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...

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.