Options

TextMode(False)

ADunberryADunberry Member Posts: 4
I'm trying to read a text file that has no CR/LF as record separator.
I'm trying to read the file in binary mode.
i created a text variable of 200 long as my records are 200 bytes each.

before i open the file i did Texmode(False)

i get an error when i try to read the first record.
it says: the text "......" in Read parameter is too long
anyone knows what i'm doing wrong

Thanks!
Andre

Comments

  • Options
    wonmowonmo Member Posts: 139
    I believe that you would have to create a BINARY variable and not a TEXT variable.
  • Options
    kinekine Member Posts: 12,562
    or you can read char by char (byte by byte) and create string (text) from them in some function like ReadString.... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    krikikriki Member, Moderator Posts: 9,090
    reading byte by byte can be slow.
    Here a trick to make it faster:
    In stead of testing all the time with the File-functions (THESE ARE SLOW), do this:
    intLength := File.LEN;
    FOR int := 1 to intLength DO BEGIN
    file.READ(chaMyChar);
    ...
    ...
    END;

    to put a char in a string, do this:
    txtString := PADSTR('',MAXSTRLEN(txtString),' ');
    txtString[intMyStringIndex] := chaMyChar;
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.