473,467 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Maximum-length reached: file change the quickest possible

I'm writing log information into a file (via StreamWriter).
When it reached a 4GB size, my MFC/C++ code copied that file to another
name, truncated its length to 0 (CFile::SetLength(0)), and continued writing
(no need to close and open, so that it was very quick).

How is it the best .net way to get this "file change" the quickest possible?

Thanks!

Ricardo Vázquez.
Madrid, Spain.
Oct 24 '07 #1
1 1605
Ricardo Vazquez <rv******@dummy.comwrote:
I'm writing log information into a file (via StreamWriter).
When it reached a 4GB size, my MFC/C++ code copied that file to another
name, truncated its length to 0 (CFile::SetLength(0)), and continued writing
(no need to close and open, so that it was very quick).

How is it the best .net way to get this "file change" the quickest possible?
I wouldn't copy the file at all - I *would* close it, rename it, and
then start a new one. That's likely to be much quicker than copying 4GB
of data over.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 24 '07 #2

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

Similar topics

6
by: Henro V | last post by:
And if there is one, is there a way to make forms that are wider? For every day on the form (first field) it needs to be followed by 52(!) datefields. I've widened the form as far as I can but I...
15
by: Lauren Wilson | last post by:
Access 2K dim MyStr as string What is the maximum amount of text or bytes that this variable can store? Does anyone know?
12
by: Steve R. Hastings | last post by:
I was looking at a Python function to find the maximum from a list. The original was more complicated; I simplified it. The built-in max() function can replace the simplified example, but not the...
5
by: Sunny123 | last post by:
hello i am trying to find the maximum value of a function and where it occur. i.e there is an array x |y ============= | |
2
by: MrNobody | last post by:
I have been struggling with .NET's scrollbars because when I use them I can't seem to get them to go to their maximum value. Searching on the web it looks like the maximum Value you can get on...
2
by: crackerbox | last post by:
I have a table that I need to find the maximum date per Doc_No per Parent_Doccategory. I can get the maximum date per Doc_No but I can't get the information for the next level. The following script...
29
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is:...
3
by: Madmartigan | last post by:
Hello I have the following task but am battling with the final output. How do I keep two different vectors in sync and how would I retrieve the index for the maximum value of one of the vectors??...
6
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm using the VScrollBar and set it as follow: m_vScrollBar.Minimum = -19602; m_vScrollBar.Maximum = 0; m_vScrollBar.SmallChange = 1; m_vScrollBar.LargeChange = 1089; m_vScrollBar.Value =...
18
by: raylopez99 | last post by:
The maximum int for an array on my machine (a Pentium IV with 2 GB RAM) is < 330 Million...before you get an "out of memory" exception. I simply filled an array of this size with ints...I got as...
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...
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
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,...
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: 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...
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 ...

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.