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

C#

 
AnswerRe: Windows Service in C#.Net 2.0, moving files from directory Pin
gus_br28-Feb-07 18:36
gus_br28-Feb-07 18:36 
GeneralRe: Windows Service in C#.Net 2.0, moving files from directory Pin
adnanrafiq28-Feb-07 18:54
adnanrafiq28-Feb-07 18:54 
GeneralRe: Windows Service in C#.Net 2.0, moving files from directory Pin
gus_br1-Mar-07 1:17
gus_br1-Mar-07 1:17 
QuestionHow to diplay web page inside another web page window? Pin
cebyrjoe228-Feb-07 9:27
cebyrjoe228-Feb-07 9:27 
AnswerRe: How to diplay web page inside another web page window? Pin
Wayne Phipps28-Feb-07 9:46
Wayne Phipps28-Feb-07 9:46 
AnswerRe: How to diplay web page inside another web page window? Pin
Vasudevan Deepak Kumar28-Feb-07 14:38
Vasudevan Deepak Kumar28-Feb-07 14:38 
QuestionHow to retrieve non fixed-length records from a binary file Pin
htres28-Feb-07 9:20
htres28-Feb-07 9:20 
AnswerRe: How to retrieve non fixed-length records from a binary file Pin
Luc Pattyn28-Feb-07 10:14
sitebuilderLuc Pattyn28-Feb-07 10:14 
Hi,

assuming you are in control of the file format, this is what I suggest:
prefix each record with a byte indicating the record type, and terminate the file with
yet another record type (I suggest a zero byte here). So a file would look like this:

type0 record0 type1 record1 type2 record2 ... typeN recordN 0

Now each record could correspond to a C# struct, and that struct could contain
a Save(stream) method to append the struct as a record to the file stream (dont forget
the type byte!), and a Load(stream) method to create and populate a struct by reading
from the file stream (starting after the type byte).

Now loading the file stream would consist of a loop containing
- read the byte that tells the record type
- use a switch to call the right struct's Load method
- if end-code, close stream

If you cant follow the above scheme (e.g. because the file format has been fixed
and does not include a type byte), then you need to determine the type of the next record
by reading and analyzing some bytes, then rewind a bit (using
Seek method or Position property) and Load a record; repeat until done.

Hope this helps.

Smile | :)



Luc Pattyn

[My Articles]

GeneralRe: How to retrieve non fixed-length records from a binary file Pin
htres1-Mar-07 3:04
htres1-Mar-07 3:04 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
Luc Pattyn1-Mar-07 7:07
sitebuilderLuc Pattyn1-Mar-07 7:07 
AnswerRe: How to retrieve non fixed-length records from a binary file Pin
htres5-Mar-07 4:48
htres5-Mar-07 4:48 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
Luc Pattyn5-Mar-07 11:14
sitebuilderLuc Pattyn5-Mar-07 11:14 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
htres5-Mar-07 13:11
htres5-Mar-07 13:11 
AnswerRe: How to retrieve non fixed-length records from a binary file Pin
DavidAtAscent28-Feb-07 14:12
DavidAtAscent28-Feb-07 14:12 
QuestionHow to add new control instances with sprcified name from within a custom control at design time Pin
Galib Anwar28-Feb-07 9:08
Galib Anwar28-Feb-07 9:08 
QuestionRegistering a COM component to use in VB6 Pin
gus_br28-Feb-07 8:31
gus_br28-Feb-07 8:31 
AnswerRe: Registering a COM component to use in VB6 Pin
mike montagne28-Feb-07 8:43
mike montagne28-Feb-07 8:43 
AnswerRe: Registering a COM component to use in VB6 Pin
DavidAtAscent28-Feb-07 13:49
DavidAtAscent28-Feb-07 13:49 
QuestionDataGridView DataBinding problem Pin
royk12328-Feb-07 8:11
royk12328-Feb-07 8:11 
QuestionHow to Fix the Column Width? Pin
Khoramdin28-Feb-07 8:03
Khoramdin28-Feb-07 8:03 
AnswerRe: How to Fix the Column Width? Pin
Ed.Poore28-Feb-07 8:18
Ed.Poore28-Feb-07 8:18 
Questionc# installer - exception throws - space inbetween folder name Pin
jtamil2001@yahoo.com28-Feb-07 7:52
jtamil2001@yahoo.com28-Feb-07 7:52 
AnswerRe: c# installer - exception throws - space inbetween folder name Pin
Stefan Troschuetz28-Feb-07 7:57
Stefan Troschuetz28-Feb-07 7:57 
GeneralRe: c# installer - exception throws - space inbetween folder name Pin
jtamil2001@yahoo.com1-Mar-07 0:38
jtamil2001@yahoo.com1-Mar-07 0:38 
GeneralRe: c# installer - exception throws - space inbetween folder name Pin
Stefan Troschuetz1-Mar-07 0:57
Stefan Troschuetz1-Mar-07 0: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.