Click here to Skip to main content
15,170,505 members
Home / Discussions / C#
   

C#

 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
Dave Kreskowiak14-Jul-21 5:16
mveDave Kreskowiak14-Jul-21 5:16 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
jschell17-Jul-21 11:37
Memberjschell17-Jul-21 11:37 
Question.Tag File Pin
f6112-Jul-21 20:44
Memberf6112-Jul-21 20:44 
AnswerRe: .Tag File Pin
Victor Nijegorodov12-Jul-21 21:38
MemberVictor Nijegorodov12-Jul-21 21:38 
AnswerRe: .Tag File Pin
Ralf Meier12-Jul-21 21:56
professionalRalf Meier12-Jul-21 21:56 
AnswerRe: .Tag File Pin
OriginalGriff12-Jul-21 22:18
mveOriginalGriff12-Jul-21 22:18 
AnswerRe: .Tag File Pin
Eddy Vluggen13-Jul-21 1:18
professionalEddy Vluggen13-Jul-21 1:18 
GeneralRe: .Tag File Pin
harold aptroot13-Jul-21 8:45
Memberharold aptroot13-Jul-21 8:45 
Yes, that code is clearly wrong. I can tell without knowing how TAG files work. I've seen some hints that TAG files are text files, but I could not find out the exact format, at least not with the amount of effort that I feel like putting into this question. IDK if this question really deserves it, but I feel like some slightly more helpful comments could be made about it..

Reading 10000 bytes and then ignoring them is probably a bad thing. It looks like a relic from some code that you copied that reads a file in 10000-byte blocks (a weird block size, not a round number). The while (count != 0) part in particular makes me think that. That style is reasonable if and only if you update count by doing another read in the loop. As it is, it makes no sense: that loop either does not start, or continues until it runs headlong into an exception, there is no normal way for it to terminate. Block-based reading and text files are an awkward match anyway.

BinaryReader.ReadString is the counterpart to BinaryWriter.Write(String). It uses a particular format of length-preceded string, with the length encoded in 7 bit chunks with a continuation bit. You won't find that kind of string in a text file. What you actually need here depends on format of TAG files, which I don't know and don't feel like getting into. Presumably you have a file that you're reading, putting you in a better position to figure this out than any of us. Possibly some combination of TextReader.ReadLine and splitting strings (not the most efficient approach, but probably fine). You could go for File.ReadAllLines too. If TAG files have no line-breaks then do something else.

modified 15-Jul-21 15:01pm.

AnswerRe: .Tag File Pin
Dave Kreskowiak15-Jul-21 9:25
mveDave Kreskowiak15-Jul-21 9:25 
Questionusing all drives Pin
Mr Shah 411-Jul-21 1:39
MemberMr Shah 411-Jul-21 1:39 
AnswerRe: using all drives Pin
OriginalGriff11-Jul-21 2:23
mveOriginalGriff11-Jul-21 2:23 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 2:33
MemberMr Shah 411-Jul-21 2:33 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 2:40
mveOriginalGriff11-Jul-21 2:40 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 2:45
MemberMr Shah 411-Jul-21 2:45 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 2:51
mveOriginalGriff11-Jul-21 2:51 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 2:56
MemberMr Shah 411-Jul-21 2:56 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 3:21
mveOriginalGriff11-Jul-21 3:21 
GeneralRe: using all drives Pin
Richard MacCutchan11-Jul-21 3:45
mveRichard MacCutchan11-Jul-21 3:45 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 4:12
mveOriginalGriff11-Jul-21 4:12 
GeneralRe: using all drives Pin
Richard Andrew x6411-Jul-21 5:01
professionalRichard Andrew x6411-Jul-21 5:01 
GeneralRe: using all drives Pin
Eddy Vluggen11-Jul-21 8:06
professionalEddy Vluggen11-Jul-21 8:06 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 8:19
MemberMr Shah 411-Jul-21 8:19 
GeneralRe: using all drives Pin
Eddy Vluggen11-Jul-21 13:25
professionalEddy Vluggen11-Jul-21 13:25 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 16:43
MemberMr Shah 411-Jul-21 16:43 
GeneralRe: using all drives Pin
Eddy Vluggen12-Jul-21 8:57
professionalEddy Vluggen12-Jul-21 8:57 

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.