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

StreamWriter loses format of existing text?

Hello,

My code is suppose to write to an existing file. But after my C# code
appends the file, the previous text loses all the endline characters,
becoming one long line. How can I retain the formating of the pre-existing
text?

FileStream stream = new FileStream(strFileName, FileMode.Append,
FileAccess.Write);

StreamWriter writer = new StreamWriter(stream);

writer.WriteLine(strErrorMessage);

Thanks in advancefor any help....

Duckwon
Mar 21 '07 #1
24 3629
Duckwon <Du*****@discussions.microsoft.comwrote:
My code is suppose to write to an existing file. But after my C# code
appends the file, the previous text loses all the endline characters,
becoming one long line. How can I retain the formating of the pre-existing
text?

FileStream stream = new FileStream(strFileName, FileMode.Append,
FileAccess.Write);

StreamWriter writer = new StreamWriter(stream);

writer.WriteLine(strErrorMessage);

Thanks in advancefor any help....
You haven't shown how you're constructing strErrorMessage in the first
place.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
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
Mar 21 '07 #2
At the moment its just a simple

string strErrorMessage = dCurrentTime.Date + " " + dCurrentTime.TimeOfDay +
": " + strFile + ", Line " + nLine.ToString() + ": " + strError;

strFile and strError are also strings with test text such as "Test"

The file with the pre-existing text that I am trying to append, was created
and previously written to in C++. Is this maybe an encoding problem? If so,
how would I go about fixing it?

Thanks for helping

"Jon Skeet [C# MVP]" wrote:
Duckwon <Du*****@discussions.microsoft.comwrote:
My code is suppose to write to an existing file. But after my C# code
appends the file, the previous text loses all the endline characters,
becoming one long line. How can I retain the formating of the pre-existing
text?

FileStream stream = new FileStream(strFileName, FileMode.Append,
FileAccess.Write);

StreamWriter writer = new StreamWriter(stream);

writer.WriteLine(strErrorMessage);

Thanks in advancefor any help....

You haven't shown how you're constructing strErrorMessage in the first
place.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
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
Mar 21 '07 #3
Duckwon <Du*****@discussions.microsoft.comwrote:
At the moment its just a simple

string strErrorMessage = dCurrentTime.Date + " " + dCurrentTime.TimeOfDay +
": " + strFile + ", Line " + nLine.ToString() + ": " + strError;

strFile and strError are also strings with test text such as "Test"

The file with the pre-existing text that I am trying to append, was created
and previously written to in C++. Is this maybe an encoding problem? If so,
how would I go about fixing it?
It's hard to say. It could be, or it could be that the C++ code is
using a different end of line string.

Could you mail me with a sample file, both before and after?

--
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
Mar 21 '07 #4
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.com...
Hello,

My code is suppose to write to an existing file. But after my C# code
appends the file, the previous text loses all the endline characters,
becoming one long line. How can I retain the formating of the pre-existing
text?

FileStream stream = new FileStream(strFileName, FileMode.Append,
FileAccess.Write);

StreamWriter writer = new StreamWriter(stream);

writer.WriteLine(strErrorMessage);

Thanks in advancefor any help....

Duckwon


This is very unlikely, pre-existing data in a file opened in Append mode, cannot be changed,
it's not possible to write before the current file pointer. What are you using to inspect
the file contents, before and after appending?

Willy.
Mar 21 '07 #5
I sent you the two files. The C++ code should be using "\n"

"Jon Skeet [C# MVP]" wrote:
Duckwon <Du*****@discussions.microsoft.comwrote:
At the moment its just a simple

string strErrorMessage = dCurrentTime.Date + " " + dCurrentTime.TimeOfDay +
": " + strFile + ", Line " + nLine.ToString() + ": " + strError;

strFile and strError are also strings with test text such as "Test"

The file with the pre-existing text that I am trying to append, was created
and previously written to in C++. Is this maybe an encoding problem? If so,
how would I go about fixing it?

It's hard to say. It could be, or it could be that the C++ code is
using a different end of line string.

Could you mail me with a sample file, both before and after?

--
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
Mar 21 '07 #6
I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.

"Willy Denoyette [MVP]" wrote:
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.com...
Hello,

My code is suppose to write to an existing file. But after my C# code
appends the file, the previous text loses all the endline characters,
becoming one long line. How can I retain the formating of the pre-existing
text?

FileStream stream = new FileStream(strFileName, FileMode.Append,
FileAccess.Write);

StreamWriter writer = new StreamWriter(stream);

writer.WriteLine(strErrorMessage);

Thanks in advancefor any help....

Duckwon

This is very unlikely, pre-existing data in a file opened in Append mode, cannot be changed,
it's not possible to write before the current file pointer. What are you using to inspect
the file contents, before and after appending?

Willy.
Mar 21 '07 #7
Duckwon <Du*****@discussions.microsoft.comwrote:
I sent you the two files. The C++ code should be using "\n"
Hmm. That's very odd - the files are very different indeed.
The file Before.txt is written in UTF-16, with a BOM, whereas the file
After.txt appears to be ASCII with alternate bytes being *spaces*
(rather than 0s).

For a start, if you're trying to append to a UTF-16 file, you ought to
open your StreamWriter using UTF-16 (Encoding.Unicode). But I can't see
what's changed the files so much, unless (as is quite possible) they've
been corrupted in the course of mailing them.

If you want me to look further, you could zip the files up and mail a
zip of them... but hopefully the above will fix the problem.

--
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
Mar 21 '07 #8
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:37**********************************@microsof t.com...
>I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.
Weird, A file opened in Append mode should not be altered.
Say you have file in which each line is terminated with LF (or CR), then notepad will show
one single line, as notepad looks for a sequence of CR LF or LF CR as line terminating
characters, LF or CR alone will not get interpreted as an EOL sequence. That means that,
when notepad shows the contents of the file "correctly", before the program runs, that this
should remain like this after you have appended some test. If the lines in the file where
terminated with CR or LF only then the contents of the file would be wrong before the
program already ran, the appended text should be shown as expected though.

So IMO, you have an input file terminated with only a LF (or CR) and notepad shows the file
as having a single line to begin with. Mind to look at the file contents using a binary
editor?

Willy.

Mar 21 '07 #9


"Willy Denoyette [MVP]" wrote:
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:37**********************************@microsof t.com...
I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.

Weird, A file opened in Append mode should not be altered.
Say you have file in which each line is terminated with LF (or CR), then notepad will show
one single line, as notepad looks for a sequence of CR LF or LF CR as line terminating
characters, LF or CR alone will not get interpreted as an EOL sequence. That means that,
when notepad shows the contents of the file "correctly", before the program runs, that this
should remain like this after you have appended some test. If the lines in the file where
terminated with CR or LF only then the contents of the file would be wrong before the
program already ran, the appended text should be shown as expected though.

So IMO, you have an input file terminated with only a LF (or CR) and notepad shows the file
as having a single line to begin with. Mind to look at the file contents using a binary
editor?

Willy.

Thanks Willy, but Jon (above) figured it out. This is my first C# project
and I've got a lot to learn. =-)

Duckwon

Mar 21 '07 #10
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:37**********************************@microsof t.com...
>I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.
Ok, I see from Jon's reply that your original file is UTF-16 encode, and you are writing to
the file using another encoding, that means that the appended text will appear incorrectly
in Notepad after running the program, but the original text should still appear as it was,
the system *may not touch* the file contents before EOF when opening in Append mode. Are you
sure you haven't touched the file using an editor that has changed the BOM and the
formatting?.

Willy.
Mar 21 '07 #11


"Jon Skeet [C# MVP]" wrote:
Duckwon <Du*****@discussions.microsoft.comwrote:
I sent you the two files. The C++ code should be using "\n"

Hmm. That's very odd - the files are very different indeed.
The file Before.txt is written in UTF-16, with a BOM, whereas the file
After.txt appears to be ASCII with alternate bytes being *spaces*
(rather than 0s).

For a start, if you're trying to append to a UTF-16 file, you ought to
open your StreamWriter using UTF-16 (Encoding.Unicode). But I can't see
what's changed the files so much, unless (as is quite possible) they've
been corrupted in the course of mailing them.

If you want me to look further, you could zip the files up and mail a
zip of them... but hopefully the above will fix the problem.

--
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
Thanks Jon! That worked! Everything is once more as it should be, order in
the universe is retored! Thanks again!

Duckwon

P.S. Yes the files really were that different.
Mar 21 '07 #12


"Willy Denoyette [MVP]" wrote:
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:37**********************************@microsof t.com...
I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.

Ok, I see from Jon's reply that your original file is UTF-16 encode, and you are writing to
the file using another encoding, that means that the appended text will appear incorrectly
in Notepad after running the program, but the original text should still appear as it was,
the system *may not touch* the file contents before EOF when opening in Append mode. Are you
sure you haven't touched the file using an editor that has changed the BOM and the
formatting?.

Willy.

Nope, only Notepad. I could open and close the file without the formating
getting changed. Until my C# code wrote to it. Using StreamWriter without the
"Encoding.Unicode" parameter definately caused the pre-existing text to lose
it's formating. When I added the parameter, the file retained the formating.
Mar 22 '07 #13
Duckwon <Du*****@discussions.microsoft.comwrote:
Nope, only Notepad. I could open and close the file without the formating
getting changed. Until my C# code wrote to it. Using StreamWriter without the
"Encoding.Unicode" parameter definately caused the pre-existing text to lose
it's formating. When I added the parameter, the file retained the formating.
But did you save the "after" file in Notepad before sending it to me?
If so, that would explain it.

I'll try to reproduce it...

--
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
Mar 22 '07 #14
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
>

"Willy Denoyette [MVP]" wrote:
>"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:37**********************************@microso ft.com...
>I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.

Ok, I see from Jon's reply that your original file is UTF-16 encode, and you are writing
to
the file using another encoding, that means that the appended text will appear
incorrectly
in Notepad after running the program, but the original text should still appear as it
was,
the system *may not touch* the file contents before EOF when opening in Append mode. Are
you
sure you haven't touched the file using an editor that has changed the BOM and the
formatting?.

Willy.


Nope, only Notepad. I could open and close the file without the formating
getting changed. Until my C# code wrote to it. Using StreamWriter without the
"Encoding.Unicode" parameter definately caused the pre-existing text to lose
it's formating. When I added the parameter, the file retained the formating.

You must have saved in notepad using a different encoding, the pre-existing contents of a
file is not affected when opening the file in append mode even not when using a different
encoding.

Willy.

Mar 22 '07 #15


"Jon Skeet [C# MVP]" wrote:
Duckwon <Du*****@discussions.microsoft.comwrote:
Nope, only Notepad. I could open and close the file without the formating
getting changed. Until my C# code wrote to it. Using StreamWriter without the
"Encoding.Unicode" parameter definately caused the pre-existing text to lose
it's formating. When I added the parameter, the file retained the formating.

But did you save the "after" file in Notepad before sending it to me?
If so, that would explain it.

I'll try to reproduce it...

--
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
I did a "Save As" to change the name. But I assure you when I open the 'Save
as' After.txt it looks the same as before I saved it. The C++ text always
looked that way after the C# code wrote to the file. I saw this behavior for
two days now without ever saving the file. Code wise, obviously the C++ code
saved the file to disk, as did the C# sharp code when it closed the writer
and/or stream. But I never did until I made a copy to send to you, and that
'After' file looks like all the previous text files after the call to
StreamWriter.

Mar 22 '07 #16


"Willy Denoyette [MVP]" wrote:
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...


"Willy Denoyette [MVP]" wrote:
"Duckwon" <Du*****@discussions.microsoft.comwrote in message
news:37**********************************@microsof t.com...
I have a breakpoint before the C# code. I check the text file using notepad
and the formatting is correct. Once the C# writes to the file, the C++ text
has lost its formating while the appended text has the correct formatting.
I'm currently running with 'it's an ecoding issue' theory, but everthing I've
tried hasn't made a differance.

Ok, I see from Jon's reply that your original file is UTF-16 encode, and you are writing
to
the file using another encoding, that means that the appended text will appear
incorrectly
in Notepad after running the program, but the original text should still appear as it
was,
the system *may not touch* the file contents before EOF when opening in Append mode. Are
you
sure you haven't touched the file using an editor that has changed the BOM and the
formatting?.

Willy.

Nope, only Notepad. I could open and close the file without the formating
getting changed. Until my C# code wrote to it. Using StreamWriter without the
"Encoding.Unicode" parameter definately caused the pre-existing text to lose
it's formating. When I added the parameter, the file retained the formating.


You must have saved in notepad using a different encoding, the pre-existing contents of a
file is not affected when opening the file in append mode even not when using a different
encoding.

Willy.

I never saved in Notepad, as I was just using it to view the file (I did
save a copy to send to Jon:explained above). Code wise, obviously the C++
code saved the file to disk, as did the C# sharp code when it closed the
writer and/or stream. But I never personally saved it. I wish I could make
you guy believe me =-)
Mar 22 '07 #17
Duckwon <Du*****@discussions.microsoft.comwrote:
I never saved in Notepad, as I was just using it to view the file (I did
save a copy to send to Jon:explained above). Code wise, obviously the C++
code saved the file to disk, as did the C# sharp code when it closed the
writer and/or stream. But I never personally saved it. I wish I could make
you guy believe me =-)
I believe that notepad displayed the file annoyingly. I don't believe
that the file you sent me is the same as it was directly after the C#
code had appended to it.

--
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
Mar 22 '07 #18
Duckwon <Du*****@discussions.microsoft.comwrote:
But did you save the "after" file in Notepad before sending it to me?
If so, that would explain it.

I'll try to reproduce it...

I did a "Save As" to change the name.
That's almost certainly the problem then.
But I assure you when I open the 'Save as' After.txt it looks the
same as before I saved it.
Yes, but that's *after* Notepad has interpreted the file. Try to
reproduce the problem (using a hex viewer like frhed to examine the
file) *without* bringing notepad into the equation. I'm 99.9% sure you
won't see the file change other than the data being appended at the
end. I certainly couldn't reproduce it.
The C++ text always looked that way after the C# code wrote to the
file. I saw this behavior for two days now without ever saving the
file. Code wise, obviously the C++ code saved the file to disk, as
did the C# sharp code when it closed the writer and/or stream.
No - the C# code just appended to the file. It didn't rewrite all the
data from the start. That's not the same as saving from Notepad, which
will rewrite all the data each time you save.
But I never did until I made a copy to send to you, and that
'After' file looks like all the previous text files after the call to
StreamWriter.
Change the name of the file using explorer instead, and I'm positive
you'll find that the part of the file that C++ wrote out to start with
will be untouched.

--
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
Mar 22 '07 #19


"Jon Skeet [C# MVP]" wrote:
Duckwon <Du*****@discussions.microsoft.comwrote:
I never saved in Notepad, as I was just using it to view the file (I did
save a copy to send to Jon:explained above). Code wise, obviously the C++
code saved the file to disk, as did the C# sharp code when it closed the
writer and/or stream. But I never personally saved it. I wish I could make
you guy believe me =-)

I believe that notepad displayed the file annoyingly. I don't believe
that the file you sent me is the same as it was directly after the C#
code had appended to it.

--
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
I sent you zipped copies of the before and after file. I zipped the files
without ever opening them… so they are untouched. After that I opened the
'after' text file in a couple of other editors (TextPad and Word). In those
cases the text kept its format. There is a font difference between the C++
text and the C# text. I would prefer the text to be seamless.

When I open the same file in Notepad I still get the unformatted C++ text
(the first portion).

This was with my original code, without your "Encoding.Unicode" fix.

Mar 22 '07 #20
Duckwon <Du*****@discussions.microsoft.comwrote:
I believe that notepad displayed the file annoyingly. I don't believe
that the file you sent me is the same as it was directly after the C#
code had appended to it.

I sent you zipped copies of the before and after file. I zipped the files
without ever opening them? so they are untouched.
And this time, lo and behold, when you look at them in a hex editor or
use a binary diff tool, we see that there is no difference between the
files until the place where the C# code started appending.
After that I opened the 'after' text file in a couple of other
editors (TextPad and Word). In those cases the text kept its format.
There is a font difference between the C++ text and the C# text. I
would prefer the text to be seamless.
The font and line ending differences are solely due to whatever the
editor chooses to do, based on a file that changes encoding half way
through.
When I open the same file in Notepad I still get the unformatted C++ text
(the first portion).
Sure - that's how it chooses to handle this problem.
This was with my original code, without your "Encoding.Unicode" fix.
Right - so the fix is the right one, it uses the same encoding for the
whole file. Now that we know it was notepad which was actually changing
the earlier contents of the file, there are no mysteries.

--
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
Mar 22 '07 #21


"Jon Skeet [C# MVP]" wrote:
Duckwon <Du*****@discussions.microsoft.comwrote:
I believe that notepad displayed the file annoyingly. I don't believe
that the file you sent me is the same as it was directly after the C#
code had appended to it.
I sent you zipped copies of the before and after file. I zipped the files
without ever opening them? so they are untouched.

And this time, lo and behold, when you look at them in a hex editor or
use a binary diff tool, we see that there is no difference between the
files until the place where the C# code started appending.
After that I opened the 'after' text file in a couple of other
editors (TextPad and Word). In those cases the text kept its format.
There is a font difference between the C++ text and the C# text. I
would prefer the text to be seamless.

The font and line ending differences are solely due to whatever the
editor chooses to do, based on a file that changes encoding half way
through.
When I open the same file in Notepad I still get the unformatted C++ text
(the first portion).

Sure - that's how it chooses to handle this problem.
This was with my original code, without your "Encoding.Unicode" fix.

Right - so the fix is the right one, it uses the same encoding for the
whole file. Now that we know it was notepad which was actually changing
the earlier contents of the file, there are no mysteries.

--
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
Understood.
Thanks Jon!
Mar 22 '07 #22
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Duckwon <Du*****@discussions.microsoft.comwrote:
Now that we know it was notepad which was actually changing
the earlier contents of the file, there are no mysteries.
True, but this happens only if you change the encoding in notepad when selecting "save as",
otherwise the file is not touched.
Which brings back the mystery as the OP said he did not save the file in Notepad.

Willy.

Mar 22 '07 #23
Willy Denoyette [MVP] <wi*************@telenet.bewrote:
Now that we know it was notepad which was actually changing
the earlier contents of the file, there are no mysteries.

True, but this happens only if you change the encoding in notepad
when selecting "save as", otherwise the file is not touched.
Which brings back the mystery as the OP said he did not save the file
in Notepad.
No, he changed the filename when he sent me the files the first time.
The second time, he didn't save in Notepad and the file was untouched.

--
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
Mar 22 '07 #24
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP***********************@msnews.microsoft.co m...
Willy Denoyette [MVP] <wi*************@telenet.bewrote:
Now that we know it was notepad which was actually changing
the earlier contents of the file, there are no mysteries.

True, but this happens only if you change the encoding in notepad
when selecting "save as", otherwise the file is not touched.
Which brings back the mystery as the OP said he did not save the file
in Notepad.

No, he changed the filename when he sent me the files the first time.
The second time, he didn't save in Notepad and the file was untouched.
Ok, mystery solved.

Willy.

Mar 22 '07 #25

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

Similar topics

5
by: Brendan Miller | last post by:
Hi, I have been having a problem writing the contents of a dataset to a .csv file. When I write to a .csv file and open it with either Excel or Wordpad the "french" characters are wrong. When I...
1
by: piotrek | last post by:
Hi. I would like to ask if there is a method to force streamwriter.writeline() to write line at the end of existing file, or should i have write the method for my own. PK
10
by: Oscar Thornell | last post by:
Hi, I generate and temporary saves a text file to disk. Later I upload this file to Microsoft MapPoint (not so important). The file needs to be in UTF-8 encoding and I explicitly use the...
2
by: David Buchan | last post by:
I have written a program to write some text to a file. Currently, if the file already exists, the program simply overwrites it. What I'd like to do, is have the program ask me if I wish to...
12
by: Nina | last post by:
Hi there, What is the maximum length that one line can hold in a text file using StreamWriter's Write or WriteLine method? If the string is too long for one line to hold, what will Write or...
2
by: gordon | last post by:
Hi, I am trying to create a reference to an external file to write to using stream writer and a value that is created in a for. Basically the value that a user will create will be the name...
1
by: ukgrl_yr79 | last post by:
hi fairly new to vb.net . I have created a filesystem where a manager and co workers hve limted access. the manager can read members files. i have used streamreader to get the details from...
1
by: MSwanston | last post by:
Hi I need some help with saving retreiving data from the cache, and how best to structure my code. FYI am working in VS2005/under .NET2 Framework. Ok, we have a series of reports that get run via...
2
by: Eric | last post by:
Hi, i'm experientating with object StreamWriter in asp.net. This code works: the string is written to an excel sheet, but i have a questions about it: how does asp.net know the string must be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.