Click here to Skip to main content
15,921,841 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help with DataGridView Pin
Petar Srdanovic12-Jul-06 0:46
Petar Srdanovic12-Jul-06 0:46 
QuestionBatch Files Pin
Ali Mola11-Jul-06 22:11
Ali Mola11-Jul-06 22:11 
AnswerRe: Batch Files Pin
wasife11-Jul-06 22:19
wasife11-Jul-06 22:19 
AnswerRe: Batch Files Pin
Ravi Bhavnani12-Jul-06 2:36
professionalRavi Bhavnani12-Jul-06 2:36 
QuestionC# 2005 with Crystal Reports Pin
M Riaz Bashir11-Jul-06 21:52
M Riaz Bashir11-Jul-06 21:52 
AnswerRe: C# 2005 with Crystal Reports Pin
Paul Conrad15-Jul-06 12:05
professionalPaul Conrad15-Jul-06 12:05 
QuestionReading a file & removing CRLF Pin
WinBond11-Jul-06 21:14
WinBond11-Jul-06 21:14 
AnswerRe: Reading a file & removing CRLF Pin
Andrei Ungureanu11-Jul-06 21:52
Andrei Ungureanu11-Jul-06 21:52 
Hy,
Try this:

//reading from the file.txt
FileStream fstream = File.Open("file.txt",FileMode.Open);
byte []buffer = new byte[fstream.Length];
fstream.Read(buffer,0,buffer.Length);
string message = System.Text.Encoding.ASCII.GetString(buffer);
message.Replace("\n","");
fstream.Close();

//writing fileSave.txt
fstream = File.Open("fileSave.txt",FileMode.Create,FileAccess.Write);
buffer = System.Text.Encoding.ASCII.GetBytes(message);
fstream.Write(buffer,0,buffer.Length);
fstream.Flush();
fstream.Close();

You use the Replace method to replace the CRLF. If this doesn't work only with replacing '\n', try replacing '\r' too.
There could be another way in this example. In the byte array "buffer" search for 13(ascii decimal value for CR) and 10(LF) values that are sequential. If you find these values delete them from the byte array

Do your best to be the best
GeneralRe: Reading a file & removing CRLF Pin
WinBond11-Jul-06 23:32
WinBond11-Jul-06 23:32 
AnswerRe: Reading a file & removing CRLF Pin
Christian Graus12-Jul-06 4:06
protectorChristian Graus12-Jul-06 4:06 
QuestionChecking the input parameters Pin
Brendan Vogt11-Jul-06 21:10
Brendan Vogt11-Jul-06 21:10 
AnswerRe: Checking the input parameters Pin
Andrei Ungureanu11-Jul-06 21:39
Andrei Ungureanu11-Jul-06 21:39 
GeneralRe: Checking the input parameters Pin
J4amieC11-Jul-06 21:56
J4amieC11-Jul-06 21:56 
GeneralRe: Checking the input parameters Pin
Brendan Vogt12-Jul-06 3:15
Brendan Vogt12-Jul-06 3:15 
AnswerRe: Checking the input parameters Pin
Rob Philpott12-Jul-06 3:27
Rob Philpott12-Jul-06 3:27 
QuestionQuestion about NetworkStream.Read Pin
stancrm11-Jul-06 21:07
stancrm11-Jul-06 21:07 
AnswerRe: Question about NetworkStream.Read Pin
Andrei Ungureanu11-Jul-06 21:34
Andrei Ungureanu11-Jul-06 21:34 
AnswerRe: Question about NetworkStream.Read Pin
S. Senthil Kumar12-Jul-06 1:03
S. Senthil Kumar12-Jul-06 1:03 
QuestionConvert String to Time [modified] Pin
freshonlineMax11-Jul-06 20:25
freshonlineMax11-Jul-06 20:25 
AnswerRe: Covert String to Time Pin
stancrm11-Jul-06 20:29
stancrm11-Jul-06 20:29 
GeneralRe: Covert String to Time Pin
freshonlineMax11-Jul-06 21:23
freshonlineMax11-Jul-06 21:23 
GeneralRe: Covert String to Time Pin
stancrm11-Jul-06 21:25
stancrm11-Jul-06 21:25 
AnswerRe: Convert String to Time Pin
wasife11-Jul-06 22:14
wasife11-Jul-06 22:14 
QuestionChanging an item from datarow Pin
pirogramci11-Jul-06 20:19
pirogramci11-Jul-06 20:19 
AnswerRe: Changing an item from datarow Pin
freshonlineMax11-Jul-06 20:32
freshonlineMax11-Jul-06 20:32 

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.