udfFileUpper
udfFileLower
int udfFileUpper (str, str)
int udfFileLower (str, str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfFileUpper (strFileNameIn, strFileNameOut)
intBBSize = FileSizeEx (strFileNameIn, 1)
If intBBSize == "0" Then Return 0
hdlBB = BinaryAlloc (intBBSize)
intBytesRead = BinaryRead (hdlBB, strFileNameIn)
intEOD = BinaryConvert (hdlBB, 0, 0, 0, 1)
intBytesWritten = BinaryWrite (hdlBB, strFileNameOut)
hdlBB = BinaryFree (hdlBB)
Return intBytesWritten
;..........................................................................................................................................
; This UDF "udfFileUpper" writes the content of the input file to the output file in all upper case.
;..........................................................................................................................................
; (c)Detlev Dalitz.20040418.20100214.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfFileLower (strFileNameIn, strFileNameOut)
intBBSize = FileSizeEx (strFileNameIn, 1)
If intBBSize == "0" Then Return 0
hdlBB = BinaryAlloc (intBBSize)
intBytesRead = BinaryRead (hdlBB, strFileNameIn)
intEOD = BinaryConvert (hdlBB, 0, 0, 0, 2)
intBytesWritten = BinaryWrite (hdlBB, strFileNameOut)
hdlBB = BinaryFree (hdlBB)
Return intBytesWritten
;..........................................................................................................................................
; This UDF "udfFileLower" writes the content of the input file to the output file in all lower case.
;..........................................................................................................................................
; (c)Detlev Dalitz.20040418.20100214.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strFileNameIn = IntControl (1004, 0, 0, 0, 0) ; We use this file as test input.
strFileNameUpper = ItemReplace ("upper.txt", -1, strFileNameIn, ".")
strFileNameLower = ItemReplace ("lower.txt", -1, strFileNameIn, ".")

; Uppercase.
intBytesWrittenUpper = udfFileUpper (strFileNameIn, strFileNameUpper)
intResult = Run (strFileNameUpper, "")
blnResult = FileDelete (strFileNameUpper)

; Lowercase.
intBytesWrittenLower = udfFileLower (strFileNameIn, strFileNameLower)
intResult = Run (strFileNameLower, "")
blnResult = FileDelete (strFileNameLower)

:CANCEL
Exit