FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Copy File Name
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Copy File Name
Posted: Fri Jan 21, 2022 05:03 PM

dim:=directory(MyFolder+"*.*")

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Copy File Name
Posted: Fri Jan 21, 2022 05:51 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Copy File Name
Posted: Sat Jan 22, 2022 08:45 AM
I did not make an empty text file .
https://cloud.mail.ru/public/jKRA/mDdPAAgoS
The header of this file consists of 3 characters D090 D090 CC86.
D0 is Cyrillic UTF-8. After reading this file through directory() I will get AA?.txt because the FW not recognize the CC86 symbol. This symbol must be deleted. I can edit the file headers in Explorer or TC, but there are a lot of files with the CC86 symbol in my name on the network (I haven't figured out where yet), You can rename such files from FW, apparently, through the bat file

chcp 1251
cmd ren C:\file1*.pdf file2.pdf

or bat file Powershell
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Copy File Name
Posted: Sun Jan 23, 2022 07:54 AM
Hello Natter,
I didn't think I would deal with this problem so quickly myself.
Are you using xHarbur or Harbour.
With Chinese characters my test program compiled with Harbor works fine. But not with xHarbour.



Best regards,
Otto
Code (fw): Select all Collapse
#include "fivewin.ch"
     #include "ini.ch"
     
     #include "adodef.ch"
     #include "ord.ch"
     #include "xbrowse.ch"
                
     function Main()
      
      local I, cVData
      local cReturn := ""
           
      HB_CDPSELECT( "UTF8" )
      FW_SetUnicode( .T. )
           
      aDir := directory( "C:\test\source\C*.*","DHS")
      xbrowse(aDir )
           
      cVData := aDir[1,1]
      
      for I := 1 to len(cVData)
        cReturn += (str(I) + "-" + cVData + CRLF + substr( cVData, I, 1 ) + " # "+ str( ASC ( substr( cVData, I, 1 ) ) ))  + CRLF
      next
           
      ? cReturn
     
      ? memoread( "C:\test\source\" + cVData )  
      
      
      
      
    return nil
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Copy File Name
Posted: Mon Jan 24, 2022 09:20 AM
Dear Antonio,
with HARBOUR this is working fine. It is not working for me with xHarbour. But I switched the project to HARBOUR.

Best regards,
Otto
HARBOURINO now supports
HB_CDPSELECT( "UTF8" )
FW_SetUnicode( .T. )



Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Copy File Name
Posted: Mon Jan 24, 2022 10:20 AM

Otto, I built your program under Harbor and tried to read the file (not empty). I get empty :cry:

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Copy File Name
Posted: Mon Jan 24, 2022 11:12 AM
Look my screen ( file list on the left of the screen ) and tell me better your problem
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

Continue the discussion