Reading text from Middle of the txt file
-
Hi all; I m reading a txt file from line to line using StreamReader from Begin to End. Now I want that it should read the file where It left it before. from any line which i want. Regards, Ali
-
Hi all; I m reading a txt file from line to line using StreamReader from Begin to End. Now I want that it should read the file where It left it before. from any line which i want. Regards, Ali
set position of StreamReader by this :
sr.BaseStream.Position
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
set position of StreamReader by this :
sr.BaseStream.Position
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
You mean I should do this. sr.BaseStream.position=10; //where 10 is line No or something else. This is my procedure. using (StreamReader sr = new StreamReader("C:\\Windows\\System32\\Logfiles\\ex080312.log")) { String line; string [] fieldcontent = null; while ((line = sr.ReadLine()) != null) { Response.Write("<br>"+ line); } }
-
You mean I should do this. sr.BaseStream.position=10; //where 10 is line No or something else. This is my procedure. using (StreamReader sr = new StreamReader("C:\\Windows\\System32\\Logfiles\\ex080312.log")) { String line; string [] fieldcontent = null; while ((line = sr.ReadLine()) != null) { Response.Write("<br>"+ line); } }
no, position is for no. of bytes or characters hehe, its VB forum and you are asking bout VC# :rolleyes:
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
no, position is for no. of bytes or characters hehe, its VB forum and you are asking bout VC# :rolleyes:
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
Yes I m storing the Line no with each Line. but I want that when I again read this file it should start from where It left.e.g line 10. explain more.
-
Yes I m storing the Line no with each Line. but I want that when I again read this file it should start from where It left.e.g line 10. explain more.
Just store the StreamReader.Position at the same place you're storing the line number, and when you want to read again just set StreamReader.Position = storedposition and you should be able to read the same line again.