null characters in string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • andulek
    Forum Member
    • Feb 2009
    • 30

    null characters in string

    greetings,

    i use in my project some DLL which sends and gets information from COM port. in receiving and trensmitting strings may occur null characters. Autoplay media studio thinks that there is End Of String, as it is null terminated one.
    is there a way to overcome this?

    A.
  • Imagine Programming
    Indigo Rose Customer
    • Apr 2007
    • 4251

    #2
    Rewrite the dll and first remove the nullchars (or replace them with others)

    Once a string get's returned to AMS it ends it at a nullchar when it occures

    Reading from a file and keep the nullchars is possible using lua's io.read(sFilepath, "rb") < read binary, but every AMS function stops a string at the nullchar.
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment

    • andulek
      Forum Member
      • Feb 2009
      • 30

      #3
      editing the DLL isn't possible as it is not mine DLL but a ActiveX object which i doenloaded. doesn't autoplay or LUA have something like typecast (like c++).
      when activex returns string it makes it a number table for example?

      Comment

      • Imagine Programming
        Indigo Rose Customer
        • Apr 2007
        • 4251

        #4
        Can you write ByVal libs? You could write a wrapper for it..
        Bas Groothedde
        Imagine Programming :: Blog

        AMS8 Plugins
        IMXLH Compiler

        Comment

        • andulek
          Forum Member
          • Feb 2009
          • 30

          #5
          you mean another DLL or EXE to be between AMS and ActiveX? i dont think it is really good as i use events from DLL, and fire them throug LUA, so code doesnt need to run all the time, only when something triggers it. i will loose this functionality if something is between, then the best solution is to write ActiveX myself

          Comment

          • reteset
            Indigo Rose Customer
            • May 2006
            • 1688

            #6
            what type of string did your ActiveX return
            or is it a VB ActiveX or ALT C++ or Delphi
            amsplugins.com Is Closed.

            Facebook Page

            Comment

            • andulek
              Forum Member
              • Feb 2009
              • 30

              #7
              reteset:

              it is a "Scientific Component" company's made, there is said that it is a C++ one. does it change anything?

              Comment

              • reteset
                Indigo Rose Customer
                • May 2006
                • 1688

                #8
                yes,

                it may return first character and not others
                it may return unexpected characters instead of actual string
                it may convert some characters in actual string


                and so........

                some string types requires custom methods to read them
                even if it is returned from a function or it is a property
                amsplugins.com Is Closed.

                Facebook Page

                Comment

                • andulek
                  Forum Member
                  • Feb 2009
                  • 30

                  #9
                  hmm, as far as i tested it works allright, and AMS understands what is returned as string (all chars starting from 0x01) but not the null one. so, as i see there is no way to do anything with this. I use this ActiveX basically because it has events. Simple RS232 DLL i have written myself in VC++, but AMS dll_call doesnt allow to 'open' dll and then use multiple functions without closing the connection. so RS232 port at EVERY call must do 'OPEN->SEND->READ->CLOSE' (not good solution, heh). is it hard to code ActiveX (assuming i have DLL code) and now need to add only ActiveX capabilities, and events?

                  edit:
                  my DLL uses number table instead of string.
                  Last edited by andulek; 03-05-2009, 04:29 AM.

                  Comment

                  Working...
                  X