How to read a file with structure in csharp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • huynhdt
    New Member
    • Mar 2010
    • 2

    How to read a file with structure in csharp

    Hi, everyone.

    I have a file with structure as below.
    Code:
    public struct Security
    
    {
        public int StockNo (2 byte);
        public String StockSymbol(8 byte);
        public String StockType(1 byte);
        public double Ceiling(4 byte);
        public double Floor(4 bype);
        public double BigLotValue(8 bype);
        public string SecurityName(25 bype);
        public string SectorNo(1 bype);
        public string Designated(1 bype);
        public string Suspension(1 bype);
        public string Delist(1 bype);
        public string HaltResumeFlag(1 bype);
        public string Split(1 bype);
        public string Benefit(1 bype);
        public string Meeting(1 bype);
        public string Notice(1 bype);
        public string ClientIDRequest(1 bype);
        public Int32 CouponRate(2 bype);
        public string IssueDate(6 bype);
        public string MatureDate(6 bype);
        public double AvrPrice(4 bype);
        public Int32 ParValue(2 bype);
        public string SDCFlag(1 bype);
        public double PriorClosePrice(4 bype);
        public string PriorCloseDate(6 bype);
        public double ProjectOpen(4 bype);
        public double OpenPrice(4 bype);
        public double Last(4 bype);
        public double LastVol(4 bype);
        public double LastVal(8 bype);
        public double Highest(4 bype);
        public double Lowest(4 bype);
        public double Totalshare(8 bype);
        public double TotalValue(2 bype);
        public double AccumulateDeal(2 bype);
        public Int32 BigDeal(4 bype);
        public double BigVol(8 bype);
        public double BigVal(2 bype);
        public Int32 OddDeal(4 bype);
        public double OddVol(8 bype);
        public double OddVal(4 bype);
        public double Best1Bid(4 bype);
        public double Best1BidVolume(4 bype);
        public double Best2Bid(4 bype);
        public double Best2BidVolume(4 bype);
        public double Best3Bid(4 bype);
        public double Best3BidVolume(4 bype);
        public double Best1Offer(4 bype);
        public double Best1OfferVolume(4 bype);
        public double Best2Offer(4 bype);
        public double Best2OfferVolume(4 bype);
        public double Best3Offer(4 bype);
        public double Best3OfferVolume(4 bype);
        public Int32 BoardLost(2 bype);
    }
    Here is the orginal file http://www.mediafire.com/?fqtjzqvroji
    The file is created by other person with other language program i do not know. I am also not sure it be done in binary write. How can i read all data and Binding to DataGrid in csharp.

    I need your help.

    Sorry for my bad english.

    Thank in advanced.
    Last edited by tlhintoq; Mar 8 '10, 02:13 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    Working...