Click here to Skip to main content
15,886,055 members
Home / Discussions / C#
   

C#

 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
Dave Kreskowiak14-Jul-21 4:16
mveDave Kreskowiak14-Jul-21 4:16 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
jschell17-Jul-21 10:37
jschell17-Jul-21 10:37 
Question.Tag File Pin
f6112-Jul-21 19:44
f6112-Jul-21 19:44 
AnswerRe: .Tag File Pin
Victor Nijegorodov12-Jul-21 20:38
Victor Nijegorodov12-Jul-21 20:38 
AnswerRe: .Tag File Pin
Ralf Meier12-Jul-21 20:56
mveRalf Meier12-Jul-21 20:56 
AnswerRe: .Tag File Pin
OriginalGriff12-Jul-21 21:18
mveOriginalGriff12-Jul-21 21:18 
AnswerRe: .Tag File Pin
Eddy Vluggen13-Jul-21 0:18
professionalEddy Vluggen13-Jul-21 0:18 
GeneralRe: .Tag File Pin
harold aptroot13-Jul-21 7:45
harold aptroot13-Jul-21 7: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 8:25
mveDave Kreskowiak15-Jul-21 8:25 
Questionusing all drives Pin
Mr Shah 411-Jul-21 0:39
Mr Shah 411-Jul-21 0:39 
AnswerRe: using all drives Pin
OriginalGriff11-Jul-21 1:23
mveOriginalGriff11-Jul-21 1:23 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 1:33
Mr Shah 411-Jul-21 1:33 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 1:40
mveOriginalGriff11-Jul-21 1:40 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 1:45
Mr Shah 411-Jul-21 1:45 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 1:51
mveOriginalGriff11-Jul-21 1:51 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 1:56
Mr Shah 411-Jul-21 1:56 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 2:21
mveOriginalGriff11-Jul-21 2:21 
GeneralRe: using all drives Pin
Richard MacCutchan11-Jul-21 2:45
mveRichard MacCutchan11-Jul-21 2:45 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 3:12
mveOriginalGriff11-Jul-21 3:12 
GeneralRe: using all drives Pin
Richard Andrew x6411-Jul-21 4:01
professionalRichard Andrew x6411-Jul-21 4:01 
GeneralRe: using all drives Pin
Eddy Vluggen11-Jul-21 7:06
professionalEddy Vluggen11-Jul-21 7:06 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 7:19
Mr Shah 411-Jul-21 7:19 
GeneralRe: using all drives Pin
Eddy Vluggen11-Jul-21 12:25
professionalEddy Vluggen11-Jul-21 12:25 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 15:43
Mr Shah 411-Jul-21 15:43 
GeneralRe: using all drives Pin
Eddy Vluggen12-Jul-21 7:57
professionalEddy Vluggen12-Jul-21 7: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.