how to read a file content, that file was already opened ?
-
I try these code, but doesn't work,
string file = @"e:\test.log"; FileStream fs1 = new FileStream(file, FileMode.Append, FileAccess.Write, FileShare.Read); FileStream fs2 = new FileStream(file, FileMode.Open, FileAccess.Read);
throw an exception: System.IO.IOException: The process cannot access the file 'e:\test.log' because it is being used by another process.. how to solve this?Glad to discuss with you and best wishes.
-
I try these code, but doesn't work,
string file = @"e:\test.log"; FileStream fs1 = new FileStream(file, FileMode.Append, FileAccess.Write, FileShare.Read); FileStream fs2 = new FileStream(file, FileMode.Open, FileAccess.Read);
throw an exception: System.IO.IOException: The process cannot access the file 'e:\test.log' because it is being used by another process.. how to solve this?Glad to discuss with you and best wishes.
FileStream fs1 = new FileStream(file, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
FileStream fs2 = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);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-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
FileStream fs1 = new FileStream(file, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
FileStream fs2 = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);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-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
thanks for your reply, i have tried this, throw the same exception. i nearly tried all 'FileAccess', 'FileShare' combination :(
Glad to discuss with you and best wishes.
well, I check this and its working without any error
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-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
well, I check this and its working without any error
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-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
Sorry for my mistake, i create a test project like the first message, and it works. but in my real project, it always throw the exception... I wrote a singleton mode class, Logger class, to write log to file. This logger class has 'LogLevel' property, the actions like in log4net. then, i wrote a unit test class to test its LogLevel property setting will work. ... I use the first FileStream in Logger class, then I use the second FileStream in Logger Unit Test class, to check log message is corrent. ... the second FileStream always throw that exception. :(
Glad to discuss with you and best wishes.
-
well, I check this and its working without any error
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-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
thanks, i fixed it with your help. i debug the code very carefully, find the exception was throw by next sentence. StreamReader reader = new StreamReader(fileStream); but not new FileStream(), so i changed StreamReader to fileStream.GetByte(..) then it works. :rose::rose::rose:
Glad to discuss with you and best wishes.
-
thanks, i fixed it with your help. i debug the code very carefully, find the exception was throw by next sentence. StreamReader reader = new StreamReader(fileStream); but not new FileStream(), so i changed StreamReader to fileStream.GetByte(..) then it works. :rose::rose::rose:
Glad to discuss with you and best wishes.
glad, you got it work ;)
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-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can