Home > Community > Forums > PCB SKILL > axlGetAttachment adds a NUL character at the end of the file

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 axlGetAttachment adds a NUL character at the end of the file 

Last post Wed, Apr 10 2013 2:12 PM by VijayVela. 2 replies.
Started by VijayVela 10 Apr 2013 10:06 AM. Topic has 2 replies and 680 views
Page 1 of 1 (3 items)
Sort Posts:
  • Wed, Apr 10 2013 10:06 AM

    • VijayVela
    • Not Ranked
    • Joined on Tue, May 31 2011
    • Posts 11
    • Points 145
    axlGetAttachment adds a NUL character at the end of the file Reply

    Hi all,
    I have a problem with the axlGetAttachment function.
    This is what I do...

    a=axlGetAttachment("testFile.txt" 'file)
    renameFile(a->data "MyTestFile.txt")        - this is to get the file saved into the working folder
    p_myFile = infile("MyTestFile.txt") 
    while(_text=lineread(p_myFile )
         println(_text)
    ); end while
    close(p_myFile)

    The problem is, when the attachement if fetched back from the database, it adds a NUL character at the end of the file.
    In notepad++, it shows as a NUL and in Wordpad it shows as a blankspace
    When the script above is run, it halts with an error:-

    (("REMARKS_AR1" "testing this out,,"))
    E-
    E- SYNTAX ERROR found at line 6 column 1 of file MyTestFile.txt
    E- *Error* lineread/read: syntax error encountered in input
    ERROR

    Any idea on how to handle this?

    Thanks


    Vijay Anandh Vela

    • Post Points: 20
  • Wed, Apr 10 2013 1:12 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 736
    • Points 15,930
    Re: axlGetAttachment adds a NUL character at the end of the file Reply

    Maybe try:

    while(gets(_text p_myFile )

    Dave Elder, Tait Communications
    • Post Points: 20
  • Wed, Apr 10 2013 2:12 PM

    • VijayVela
    • Not Ranked
    • Joined on Tue, May 31 2011
    • Posts 11
    • Points 145
    Re: axlGetAttachment adds a NUL character at the end of the file Reply

    Works great now...
    Thanks Dave...


    Regards,
    Vijay Anandh Vela

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by VijayVela at 10 Apr 2013 10:06 AM. Topic has 2 replies.