
Bug in Harbour Descend()
Re: Bug in Harbour Descend()
For me run OK


Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
- karinha
- Posts: 7948
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Code: Select all | Expand
#include "Fivewin.ch"
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
FUNCTION MAIN()
LOCAL cFile
HB_CDPSELECT( "IT850" )
HB_LANGSELECT( "IT" )
HB_SETTERMCP( "ITWIN", "ITWIN", .T. )
HB_CDPSELECT( "UTF8" )
HB_SETCODEPAGE( "UTF8" )
IF FILE( "ENRICO.txt" )
ERASE "ENRICO.txt"
ENDIF
// MEMOWRIT( "ENRICO.txt", HB_OemToAnsi( "àèéìòù" ) )
MEMOWRIT( "ENRICO.txt", "àèéìòù" )
cFile := "ENRICO.txt"
WinExec( "Notepad.exe " + cFile )
RETURN NIL
// fin / end
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Enrico Maria Giordano
- Posts: 8761
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 5 times
- Contact:
Re: Bug in Harbour Descend()
cnavarro wrote:For me run OK
Code: Select all | Expand
#include "Fivewin.ch"
FUNCTION MAIN()
HB_SETCODEPAGE( "UTF8" )
? HB_MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
Result: .F., and no file written.

- Enrico Maria Giordano
- Posts: 8761
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 5 times
- Contact:
Re: Bug in Harbour Descend()
karinha wrote:Code: Select all | Expand
MEMOWRIT( "ENRICO.txt", "àèéìòù" )
It doesn't work with this:
Code: Select all | Expand
MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
- Enrico Maria Giordano
- Posts: 8761
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 5 times
- Contact:
Re: Bug in Harbour Descend()
A workaroud that seems to work fine:
Code: Select all | Expand
#include "Fivewin.ch"
REQUEST HB_CODEPAGE_ITWIN
#xtranslate DESCEND( STR( <nVal>[, <nLen>][, <nDec>] ) ) => Str( 999999999999999 - <nVal> )
#xtranslate DESCEND( DTOS( <dVal> ) ) => Str( Descend( <dVal> ) )
FUNCTION MAIN()
LOCAL aData[ 8 ]
LOCAL i
HB_SETCODEPAGE( "ITWIN" )
aData[ 1 ] = { "TEST1", 3107.77 }
aData[ 2 ] = { "TEST2", 852.07 }
aData[ 3 ] = { "TEST3", 191.00 }
aData[ 4 ] = { "TEST4", 148.68 }
aData[ 5 ] = { "TEST5", 44.73 }
aData[ 6 ] = { "TEST6", 15.24 }
aData[ 7 ] = { "TEST7", 255.65 }
aData[ 8 ] = { "TEST8", 44.88 }
ASORT( aData, , , { | aItem1, aItem2 | Descend( Str( aItem1[ 2 ], 10, 2 ) ) + aItem1[ 1 ] < Descend( Str( aItem2[ 2 ], 10, 2 ) ) + aItem2[ 1 ] } )
FOR i = 1 TO LEN( aData )
? aData[ i, 1 ], aData[ i, 2 ]
NEXT
? MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
RETURN NIL