Options

Sizes of files when textmode are False or TRUE

wwestendorpwwestendorp Member Posts: 178
I've seen some questions about this but I still don't know the right answers.

You have opened a File variable and are using it to export data from Microsoft Navision. Suppose you execute the following line of C/AL code:

XFile.WRITE('Line No.);

where 'Line No.' is a field of type integer. What is the total number of bytes that will be added to the file due to the above line of code, if 'Line No.' had a value of 1000, and if the TEXTMODE for xFile was set to FALSE
A) 4 bytes
B) 6 Bytes
C) 8 bytes
D) 2 bytes

Somewhere I heard that the correct answer must be C)

If the TEXTMODE was set on TRUE the correct answer must be B)

I tested this via this code

xfile.WRITEMODE(TRUE);
xfile.TEXTMODE(FALSE);
xfile.QUERYREPLACE(TRUE);
xfile.CREATE('c:\false.txt');
xfile.WRITE('1000');

The size of the dokument was 5 bytes

With this code

xfile.WRITEMODE(TRUE);
xfile.TEXTMODE(TRUE);
xfile.QUERYREPLACE(TRUE);
xfile.CREATE('c:\true.txt');
xfile.WRITE('1000')

The size of the dokument was 6 bytes

Who can Help me with the correct answer to the case (TEXTMODE = FALSE) ?? :shock:

Comments

  • Options
    wwestendorpwwestendorp Member Posts: 178
    of posting it in the existing developer one ](*,)
  • Options
    kinekine Member Posts: 12,562
    1) Integer is 4byte (max value 2,147,483,647 = 0x7FFFFFFF = 4 bytes)
    2) Because Integer is 4 byte, if you have textmode = false, file will have size of SizeOf(Variable) + 1 byte EOF. = 5 bytes
    3) If you have textmode = true, the filesize is LENGTH(Variable) + 2 bytes (CR+LF) = 6 bytes in case of value '1000'
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    wwestendorpwwestendorp Member Posts: 178
    kine wrote:
    1) Integer is 4byte (max value 2,147,483,647 = 0x7FFFFFFF = 4 bytes)
    2) Because Integer is 4 byte, if you have textmode = false, file will have size of SizeOf(Variable) + 1 byte EOF. = 5 bytes
    3) If you have textmode = true, the filesize is LENGTH(Variable) + 2 bytes (CR+LF) = 6 bytes in case of value '1000'


    Thanks these where 2 correct answers of my 94% =D>
Sign In or Register to comment.