Consultor Eletrônico



Kbase P91729: File changes size when exported.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/08/2004
Status: Unverified

SYMPTOM(s):

File changes size when exported.

Imported previously the file and exported afterwards without modifying it.

Using binary import and standart export.

The files are the same but the sizes are different.

Carriage return character is changed

CAUSE:

Your code converts a single line feed character <LF>, which is ASCII Character 10 or a single carriage return character <CR>, which is ASCII Character 13 to <CR>/<LF>. So, CHR(10) or CHR(13) becomes CHR(13) + CHR(10).

FIX:

In order to solve the problem output using the BINARY option. This code for example doesn't change the carriage character:
DEFINE VARIABLE myPointer AS MEMPTR.

FILE-INFO:FILE-NAME = "input.txt".
SET-SIZE(myPointer) = FILE-INFO:FILE-SIZE.

INPUT FROM "input.txt" BINARY NO-CONVERT.
IMPORT myPointer.
INPUT CLOSE.

OUTPUT TO "output.txt" BINARY .
PUT UNFORMATTED STRING(myPointer).
OUTPUT CLOSE.