How I can convert DOS texts to Windows
Probably first step of DOS to Windows migration is converting DOS texts to Windows.
“Text” may be .prg, .txt or anything else plain text files or tables ( .dbf files ) include Character or MEMO type fields.
This operation will be necessary because foreign ( non English ) characters are different in DOS and Windows.
Fortunately we have Harbour functions to use this purpose: HB_OEMTOANSI() and WIN_OEMTOANSI().
Examples :
Texts files :
cDOS_FName := "MyDOS_xxx.txt"
cWIN_FName := "MyWIN_xxx.txt"
cSourceText := MEMOREAD( cDOS_FName )
cTargetText := HB_OEMTOANSI( cSourceText )
MEMOWRIT( cWIN_FName, cTargetText )
Tables :
REPLACE ALL TEXT_FIELD WITH HB_OEMTOANSI( TEXT_FIELD )
NOTES :
– Don’t worry about file sizes; 64K limit remain in DOS. However you can use line based processing.
– Recommended :
– Use HB_MEMOREAD() and HB_MEMOWRIT() functions instead of MEMOREAD() and MEMOWRIT().
– Use WIN_OEMTOANSI( ) instead of HB_OEMTOANSI()
– Inverse functions are WIN_ANSITOOEM( ) and HB_ANSITOOEM( )