Click here to Skip to main content
15,920,508 members
Home / Discussions / C#
   

C#

 
AnswerRe: Fastest way to write a text file Pin
Russell Jones19-Mar-07 22:08
Russell Jones19-Mar-07 22:08 
GeneralRe: Fastest way to write a text file Pin
blackjack215019-Mar-07 22:33
blackjack215019-Mar-07 22:33 
GeneralRe: Fastest way to write a text file Pin
m@u19-Mar-07 23:18
m@u19-Mar-07 23:18 
GeneralRe: Fastest way to write a text file Pin
PIEBALDconsult23-Feb-10 10:46
mvePIEBALDconsult23-Feb-10 10:46 
AnswerRe: Fastest way to write a text file Pin
joon vh.19-Mar-07 22:22
joon vh.19-Mar-07 22:22 
AnswerRe: Fastest way to write a text file Pin
Guffa19-Mar-07 22:30
Guffa19-Mar-07 22:30 
GeneralRe: Fastest way to write a text file Pin
joon vh.19-Mar-07 23:49
joon vh.19-Mar-07 23:49 
GeneralRe: Fastest way to write a text file Pin
Guffa20-Mar-07 2:10
Guffa20-Mar-07 2:10 
A BinaryWriter is not used to write text to a binary file, it's used to write data in binary format to a binary file. When you write a string using a BinaryWriter, it writes the length of the string, then the binary representation of the string. The string is not encoded either, so it will be in UTF-16, which is the internal format for strings.

You don't need a writer to write a binary file. A FileStream can do that.

static void test2() {
   using(FileStream fs = File.Create("test2.txt")) {
      for (int i = 0; i < linecount; i++) {
         string toprint = i.ToString() + " " + printme + "\r\n";
         byte[] buffer = Encoding.UTF8.GetBytes(toprint);
         bw.Write(buffer, 0, buffer.Length);
      }
   }
}



---
single minded; short sighted; long gone;

GeneralRe: Fastest way to write a text file Pin
joon vh.20-Mar-07 2:50
joon vh.20-Mar-07 2:50 
QuestionPlacing RadioButton in Nodes of TreeView Pin
SakthiSurya19-Mar-07 20:42
SakthiSurya19-Mar-07 20:42 
AnswerRe: Placing RadioButton in Nodes of TreeView Pin
stancrm19-Mar-07 21:03
stancrm19-Mar-07 21:03 
Questiondatagrid with checkbox for pocket pc 2003 Pin
mohdmeraj19-Mar-07 20:17
mohdmeraj19-Mar-07 20:17 
Questionhow to get create query of msaccess table through c# Pin
joerozario19-Mar-07 19:18
joerozario19-Mar-07 19:18 
AnswerRe: how to get create query of msaccess table through c# Pin
sujithkumarsl19-Mar-07 19:59
sujithkumarsl19-Mar-07 19:59 
GeneralRe: how to get create query of msaccess table through c# Pin
joerozario19-Mar-07 20:21
joerozario19-Mar-07 20:21 
GeneralRe: how to get create query of msaccess table through c# Pin
sujithkumarsl19-Mar-07 20:34
sujithkumarsl19-Mar-07 20:34 
GeneralRe: I want to get the create query of existing table Pin
joerozario19-Mar-07 21:10
joerozario19-Mar-07 21:10 
GeneralRe: I want to get the create query of existing table Pin
joerozario19-Mar-07 21:26
joerozario19-Mar-07 21:26 
GeneralRe: I want to get the create query of existing table Pin
Russell Jones19-Mar-07 21:56
Russell Jones19-Mar-07 21:56 
GeneralRe: I want to get the create query of existing table Pin
joerozario19-Mar-07 22:42
joerozario19-Mar-07 22:42 
GeneralRe: I want to get the create query of existing table Pin
Russell Jones20-Mar-07 3:36
Russell Jones20-Mar-07 3:36 
GeneralRe: how to get create query of msaccess table through c# Pin
V.19-Mar-07 22:57
professionalV.19-Mar-07 22:57 
QuestionOleDBConnection Pin
zenithmaximus19-Mar-07 17:27
zenithmaximus19-Mar-07 17:27 
AnswerRe: OleDBConnection Pin
sujithkumarsl19-Mar-07 19:16
sujithkumarsl19-Mar-07 19:16 
AnswerRe: OleDBConnection Pin
spotl19-Mar-07 22:48
spotl19-Mar-07 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.