CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 32
  1. #16
    Join Date
    Jun 2012
    Posts
    14

    Re: Parse file in vc++

    Implement the Parser for bin files which is in the .sx file. Please kindly help me ASAP.
    Motorola S-records

    The general format of an S-record follows:

    +-------------------//------------------//-----------------------+
    | type | count | address | data | checksum |
    +-------------------//------------------//-----------------------+

    -----------------------please below is file need to parse.

    S011000000486578766965772056312E3035D4
    S244008000A500000000008150FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD
    S2440080400000800000008000000000080000804000008040000000C800008108000081080000020C0001000000010000000001000001010000010100000000A800011000CB
    S244008080000110000000E4B00001F4B00001F4B0000000840001F5340001F534000000080001F53C0001F53C000000080001F5440001F544000005800001FAC40001FAC409
    S2440080C00000087000020800400013400000030800020B0840001648000000340000000000000000000000004000000000001340400016800000058440001C0800000424F6
    like this several S-Rec...

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Parse file in vc++

    Quote Originally Posted by Rajendramaraveni View Post
    The general format of an S-record follows:

    +-------------------//------------------//-----------------------+
    | type | count | address | data | checksum |
    +-------------------//------------------//-----------------------+

    -----------------------please below is file need to parse.
    How are these fields delimited?
    Victor Nijegorodov

  3. #18
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Parse file in vc++

    Quote Originally Posted by VictorN View Post
    How are these fields delimited?
    They aren't. They have fixed sizes.

  4. #19
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Parse file in vc++

    Quote Originally Posted by Skizmo View Post
    They aren't. They have fixed sizes.
    Well, that makes the task for OP easier!

    Dear Rajendramaraveni,
    did you read the post from GCDEF:
    Look at CStdioFile and CString::Tokenize().
    Did you look at these classes (CStdioFile and CString) description in MSDN?
    Victor Nijegorodov

  5. #20
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Parse file in vc++

    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  6. #21
    Join Date
    Jun 2012
    Posts
    14

    Re: Parse file in vc++

    S011000000486578766965772056312E3035D4
    I defined the structure Srec based on S-Record and using CMap(KEY,Srec).
    Please kindly how to Implement CMap.

  7. #22
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Parse file in vc++

    What CMap do you mean? For example, the MFC CMap template requires 4 "arguments" and is written like
    Code:
    template< class KEY, class ARG_KEY, class VALUE, class ARG_VALUE >class CMap : public CObject
    What about "your" CMap?

    cmap mfc example
    Last edited by VictorN; June 11th, 2012 at 02:17 AM.
    Victor Nijegorodov

  8. #23
    Join Date
    Jun 2012
    Posts
    14

    Re: Parse file in vc++

    struct Srec{
    Startcode char;
    Record type unsigned short int;
    Bytecount unsigned short int;
    Address unsigned long;
    Data Cstring;
    Checksum unsigned short int;
    }

    CMap <KEY,Srec>
    In my CMap what should be the key value?
    Basede the key will get the data... I am new to vc++ please...

  9. #24
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Parse file in vc++

    Quote Originally Posted by Rajendramaraveni View Post
    struct Srec{
    Startcode char;
    Record type unsigned short int;
    Bytecount unsigned short int;
    Address unsigned long;
    Data Cstring;
    Checksum unsigned short int;
    }

    CMap <KEY,Srec>
    In my CMap what should be the key value?
    Please, stop posting such a "pseudo"-code snippets. If you have no idea what CMap is - read about it in MSDN first.
    If you"d like to post some code snippet - use Code tags. And, please, read Announcement: Before you post....


    Quote Originally Posted by Rajendramaraveni View Post
    Basede the key will get the data... I am new to vc++ please...
    Then you have first learn the C++/VC++ and then start with something like "Hello World!" application.
    Victor Nijegorodov

  10. #25
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Parse file in vc++

    Why a CMap? If you know you need a map, you'd know what the key should be. If you don't know what to use for the key, you probably don't want a map.

  11. #26
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Parse file in vc++

    That link I posted was to source code that handles Motorola S-records...
    Did you read it?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  12. #27
    Join Date
    Jun 2012
    Posts
    14

    Re: Parse file in vc++

    Please How to read line by character by character or line by line...

  13. #28
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Parse file in vc++

    Quote Originally Posted by Rajendramaraveni View Post
    Please How to read line by character by character or line by line...
    Well, why don't you find a good book on C++ basics?
    Last edited by Igor Vartanov; June 12th, 2012 at 12:21 AM.
    Best regards,
    Igor

  14. #29
    Join Date
    Jun 2012
    Posts
    14

    Re: Parse file in vc++

    Quote Originally Posted by Igor Vartanov View Post
    Well, why don't you find a good book on C++ basics?
    I created CMap and how to map various fields according my .sx file Motorola
    S-record format.S00600004844521B
    Please kindly help me.

  15. #30
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Parse file in vc++

    Quote Originally Posted by Rajendramaraveni View Post
    I created CMap and how to map various fields according my .sx file Motorola
    S-record format.S00600004844521B
    Please kindly help me.
    This is getting silly. You're repeating yourself endlessly and ignoring everything people are telling you. Your question still isn't even making sense. If you have no C++ experience at all, a forum can't help you. It doesn't work that way. If you don't understand what people are saying, ask for clarification, or better yet, at least get familiar with the fundamentals of the language, but be prepared to spend some time on it. I, and I think others asked what you need to parse and why you need a map and you didn't respond.

    Repeating yourself endlessly isn't working for you. Try something different.

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured