Announcement

Collapse
No announcement yet.

Software Developer positions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Making binary files question



    Ivo,

    It should be noted though that using MvEXPORT in that manner
    still results in a line feed character being added to the end of
    the binary file. So technically it isn't a way to output a truly
    accurate binary version of the file contents.

    - Jeff Huber
    President, 4TheBest eCommerce Solutions
    http://4TheBest.com
    [email protected]
    Office: 760-742-1469
    Cell: 760-445-8454
    =20



    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]] On Behalf Of Ivo Truxa
    Sent: Tuesday, April 26, 2005 2:38 PM
    To: 'Miva Users'
    Subject: RE: [meu] Making binary files question


    You do not need any external library at all. Plain old MvEXPORT
    works just
    fine for exporting any kind of data:

    <MvEXPORT FILEfile" FIELDS=3D"l.null,l.null"
    DELIMITER=3D"{binaryData}">

    There is no limit for the binary data passed through the
    delimiter.

    As for importing - I would suggest updating to the newly released
    v5 and
    using the file_read() function.

    Ivo
    http://mivo.truxoft.com=20


    -----Original Message-----
    From: Scot Ranney


    Thanks for the tip! I completely forgot James released that
    thing-=20
    looks like it will do what I'm looking for. (insert Burns
    "excellent" here)

    MvMarkus wrote:
    > Hi Scot,
    >=20
    > (Copernicus) James released a pretty neat library for handling
    binary
    files.
    > I don't know if they can help you (or if you did not already
    use them),
    but
    > if not, you should definitely take a look at them. You can find
    them at
    the
    > open source section of his website (
    > <A HREF ="http://www.copernicusllc.com/products/source/)">http://www.copernicusllc.com/products/source/)</A>
    >=20
    > Markus=20



    Comment


      #17
      Making binary files question



      Exporting asciichar(0) always worked fine for me, but I did not test it with
      VM 5 yet. I hope it was not changed.

      As for the trailing 0x0A - at many binary files it won't mind at all, at
      others adding couple of ASCII 0 may help. At those files requiring the very
      exact match, you would need to use a bit more complicated technique using
      MvCALL, simulating file upload (to self). Of course, you can always use an
      external tool too (other language, library,...), but that's not easily
      portable solution.

      As I told, you should first verify if the trailing CR (0A) is any issue at
      all in your case, and use the more complicated or less portable techniques
      only if needed.

      Ivo
      http://mivo.truxoft.com


      -----Original Message-----
      From: Scot Ranney


      I've almost got this working, but two problems have risen up that I'm
      not sure how to deal with.

      The first is a big one- I can't get asciichar(0) or asciichar('0') to
      write to the file as hex 00 (some sort of spacer or null).

      The other is that the end of the file turns out to always be hex 0A -
      I'd like to somehow be able to control whatever is at the end of the file.

      I made this to test what works when trying to write a binary file using
      the method below:

      <MvWHILE EXPR = "{l.index LE 255}">
      <MvASSIGN NAME = "l.export" VALUE = "{ l.export $
      asciichar(l.index)}">
      <MvASSIGN NAME = "l.index" VALUE = "{ l.index + 1 }">
      </MvWHILE>

      Everything is written to the file correctly except for hex 00 and the
      last character which is hex 0A.

      Any ideas?

      Scot


      Comment


        #18
        Making binary files question



        Duh- Thanks Ivo. I was testing using the old Miva Mia which does not
        allow asciichar(0), but once compiled with, it puts the null character
        in there fine. Haven't tested it with VM5 yet.

        Thanks again-

        Scot

        Ivo Truxa wrote:
        > Exporting asciichar(0) always worked fine for me, but I did not test it with
        > VM 5 yet. I hope it was not changed.
        >
        > As for the trailing 0x0A - at many binary files it won't mind at all, at
        > others adding couple of ASCII 0 may help. At those files requiring the very
        > exact match, you would need to use a bit more complicated technique using
        > MvCALL, simulating file upload (to self). Of course, you can always use an
        > external tool too (other language, library,...), but that's not easily
        > portable solution.
        >
        > As I told, you should first verify if the trailing CR (0A) is any issue at
        > all in your case, and use the more complicated or less portable techniques
        > only if needed.
        >
        > Ivo
        > http://mivo.truxoft.com
        >
        >
        > -----Original Message-----
        > From: Scot Ranney
        >
        >
        > I've almost got this working, but two problems have risen up that I'm
        > not sure how to deal with.
        >
        > The first is a big one- I can't get asciichar(0) or asciichar('0') to
        > write to the file as hex 00 (some sort of spacer or null).
        >
        > The other is that the end of the file turns out to always be hex 0A -
        > I'd like to somehow be able to control whatever is at the end of the file.
        >
        > I made this to test what works when trying to write a binary file using
        > the method below:
        >
        > <MvWHILE EXPR = "{l.index LE 255}">
        > <MvASSIGN NAME = "l.export" VALUE = "{ l.export $
        > asciichar(l.index)}">
        > <MvASSIGN NAME = "l.index" VALUE = "{ l.index + 1 }">
        > </MvWHILE>
        >
        > Everything is written to the file correctly except for hex 00 and the
        > last character which is hex 0A.
        >
        > Any ideas?
        >
        > Scot
        >
        >

        Comment

        Working...
        X