ARCHVIO TXT

ARCHVIO TXT

Postby jbrita » Fri Jan 06, 2017 1:14 pm

amigo tengo este codigo

cArchivoTxt :=memoread("C:\SYSTEMA\PTO_CORSSA\salida.txt")
If Empty(cArchivoTxt)
MsgAlert("Archivo Vacio","Atencion" )

ElseIf !File(cArchivoTxt)
MsgAlert("Archivo no se Encuentra","Atencion" )

EndIf

y siempre me sale archivo no se encuentra

saludos
jbrita
 
Posts: 486
Joined: Mon Jan 16, 2006 3:42 pm

Re: ARCHVIO TXT

Postby jbrita » Fri Jan 06, 2017 1:24 pm

alguna ayuda es urgente el problema

saludos
jbrita
 
Posts: 486
Joined: Mon Jan 16, 2006 3:42 pm

Re: ARCHVIO TXT

Postby karinha » Fri Jan 06, 2017 1:29 pm

Code: Select all  Expand view

#Include "FiveWin.ch"

function Main()

   local cResult, cMuestra, oPrn, oFont, nLin, nLinha, nQtde

   BEGIN SEQUENCE

      cResult := MemoRead( "TESTE.TXT" )

      cMuestra := ALLTRIM( cResult )

      PRINTER oPrn NAME "Erros do Programa" PREVIEW MODAL

      DEFINE FONT oFont NAME "COURIER NEW" SIZE 0, -10 OF oPrn

      oPrn:SetPage(9)    // A4
      oPrn:SetPortrait() // Vertical

      PAGE // solo ejemplo - USE BEGIN... END..

         nLin:=1

         FOR nLinha = 1 TO MLCOUNT( cMuestra, 100 )

            oPrn:CmSay( nLin := nLin +.4, 1.5, MEMOLINE( cMuestra, 100, nLinha), oFont )

            IF nLin > 25

               nLin = 1

               ENDPAGE

               PAGE

            ENDIF

         NEXT

         ENDPAGE

      ENDPRINT

      oFont:End()

   END SEQUENCE

   ? LEN( cResult )

   nQtde := LEN( cResult )

   IF nQtde == 1384

      MsgAlert( cResult )

   ELSE

      MsgAlert( "Fallo en cResult" )

   ENDIF

return nil
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ARCHVIO TXT

Postby vilian » Fri Jan 06, 2017 1:40 pm

I think it's happening because you are using a long name in the path (\PTO_CORSSA). Try change to this:

cArchivoTxt := memoread(Lfn2Sfn("C:\SYSTEMA\PTO_CORSSA\salida.txt"))
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: ARCHVIO TXT

Postby karinha » Fri Jan 06, 2017 1:58 pm

Very good Vilian,

Code: Select all  Expand view

// FiveWin long filenames management.

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local hFile   := LCreat( "This is a long filename file.txt" )
   local cBuffer := "FiveWin long filenames management"

   FWrite( hFile, @cBuffer, Len( cBuffer ) )

   LClose( hFile )

   // LongFileName to ShortFileName. The file must exists !!!
   MsgInfo( LFN2SFN( "This is a long filename file.txt" ) )

return nil

//----------------------------------------------------------------------------//
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ARCHVIO TXT

Postby cnavarro » Fri Jan 06, 2017 2:57 pm

jbrita wrote:amigo tengo este codigo

cArchivoTxt :=memoread("C:\SYSTEMA\PTO_CORSSA\salida.txt")
If Empty(cArchivoTxt)
MsgAlert("Archivo Vacio","Atencion" )

ElseIf !File(cArchivoTxt)
MsgAlert("Archivo no se Encuentra","Atencion" )

EndIf

y siempre me sale archivo no se encuentra

saludos


Quizás asi te funcione

Code: Select all  Expand view


cMyFile   := "C:\SYSTEMA\PTO_CORSSA\salida.txt"
cArchivoTxt :=memoread( cMyFile )
If Empty(cArchivoTxt)
           MsgAlert("Archivo Vacio","Atencion" )

ElseIf !File( cMyFile )
      MsgAlert("Archivo no se Encuentra","Atencion" )

EndIf


 
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: ARCHVIO TXT

Postby xmanuel » Fri Jan 06, 2017 7:51 pm

Es pequeñito pero mal diseñado desde el principio
Cabia a esto:
Code: Select all  Expand view

    cMyFile := "C:\SYSTEMA\PTO_CORSSA\salida.txt"
   
    If File( cMyFile )
         cArchivoTxt := memoread( cMyFile )
        If Empty(cArchivoTxt)
               MsgAlert("Archivo Vacio","Atencion" )
        endif
    Else
          MsgAlert("Archivo no se Encuentra","Atencion" )
    EndIf
 
______________________________________________________________________________
Sevilla - Andalucía
xmanuel
 
Posts: 756
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests