473,471 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to write into a big textfile ?

Hello everybody, i need your help : i have to write some lines coming from a
database into a textfile;

Everything goes right while the filesize is quite small or medium; But it's
different when the file becomes a bit large, as it returns the following
error :

"The process cannot access the file because it is being used"

As my scripts were written in powershell using the function Add-Content, i
though it would be resolved by using the dotnet functions, building and
using StreamWriters or such possibilities...
but no way;

Actually, i thing the process of writing the stream into the textfile become
to slow when the filesize is big, and the following data are coming before
the first are on te file.
i don't know how to resolve my problem; is it possible to wait for the first
process to be finished before writing the new data into the file ?

Thx
Nico
Nov 9 '07 #1
1 1259
If you have another applicatin writing to the file you'll have to wait for
the other application to finish. If it is your appplication you could use a
different sharing mode; but if you're writing to the start of the file and
moving the rest of the data in the file you're probably out of luck.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Nicopil@mi" wrote:
Hello everybody, i need your help : i have to write some lines coming from a
database into a textfile;

Everything goes right while the filesize is quite small or medium; But it's
different when the file becomes a bit large, as it returns the following
error :

"The process cannot access the file because it is being used"

As my scripts were written in powershell using the function Add-Content, i
though it would be resolved by using the dotnet functions, building and
using StreamWriters or such possibilities...
but no way;

Actually, i thing the process of writing the stream into the textfile become
to slow when the filesize is big, and the following data are coming before
the first are on te file.
i don't know how to resolve my problem; is it possible to wait for the first
process to be finished before writing the new data into the file ?

Thx
Nico
Nov 10 '07 #2

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

Similar topics

7
by: Hans A | last post by:
I have a textfile "textfile.txt" containing a list of words. There is one word on each line. I want to pick two random lines from this textfile, and I have tried to do something like: //Loading...
6
by: Christian Blackburn | last post by:
Hi Gang, I have so far been unable to get the TextStream Object to write on Fat32. I'm using Windows 2000 Pro Sp4. Scripts have write access and I even tried giving IUSR user level writes and...
2
by: Thomas A | last post by:
Hi, I write a string value to a textfile , if the string dont contains swedish Å,Ä and Ö , the file will be written in ANSI. So far so god but.... If the string contains Å or Ä or Ö ,the...
1
by: Snuyt | last post by:
Hello, I try to export some text to a textfile. But when I use special characters such as é, à, è, ... I get some weird characters in the resulting file: "saisonnières et thématiques."...
5
by: francescomoi | last post by:
Hi. Using PHP 4.3.11, I want my script not to write standard output on the webpage, but on a textfile. I tried with: $variableName = 44;
7
by: nonameisfree | last post by:
I am trying to get StartUp-Manager to write the grub password in encrypted form to menu.lst. Currently it writes the password in plain-text and that is not too clever... This is the function I...
12
by: Nettan | last post by:
Hi What is the best way to write to a textfile, is it with FileSystemObject or with StreamWriter? Thanks /Nettan
1
by: | last post by:
Hello everybody, i need your help : i have to write some lines coming from a database into a textfile; Everything goes right while the filesize is quite small or medium; But it's different when...
2
by: RaviRajhulk | last post by:
I am trying to read folder and subfolder and print their name into a text file.I am able to read the folder and its content and write it to the textfile but I am not able to read the content of the...
6
by: Per Juul Larsen | last post by:
Hi. My Textfile looks like this Variable 1 Variable 2 Variable 3 Variable 4 On opening the application it will read the textfile, and assign each line of variable to at textfield in VB and...
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
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,...
0
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,...
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
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,...
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.