reading plain text file in TEXTMODE = TRUE

EugeneEugene Member Posts: 309
the problem is when i read the file
MyTxtFile.TEXTMODE(TRUE);
MyTxtFile.READ(AStr)
the tab characters (ASCII code 9) in the original file are automatically converted into spaces (ASCII code 32) in the AStr variable (of type Text 1024)
why the hell this is happening ? Can anybody point me to any MS documentation about this "feature"

Answers

  • XypherXypher Member Posts: 297
    Well, I can only assume this would be happening because Navision can't "display" tabs. Quite possibly the TEXTMODE(TRUE) setting might be doing this. But I'm no expert when it comes to low level things like this.

    Personally I don't even like using File functions where your code ends up sitting on an opened file for a period of time. (Even though it may be just a short duration of time)

    Have you tried something like this?
    TempBlob.Blob.IMPORT(varFilePath);
    TempBlob.Blob.CREATEINSTREAM(iStream);
    
    WHILE NOT iStream.EOS DO BEGIN
      IF iStream.READTEXT(AStr) > 0 THEN BEGIN
        //...do your thang...
      END;
    END;
    


    Why are the tabs so important when you are reading from a file into Navision? What exactly are you trying to do?
  • EugeneEugene Member Posts: 309
    i was trying to read Excel file saved as tab delimited plain text
    now i switched to CSV format
Sign In or Register to comment.