Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Your opinion
Message
 
À
30/11/2005 17:02:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01073478
Message ID:
01073487
Vues:
14
Parameters tcOpenFile, tcFileName
Local lcFileName, lnHandle, lnOHandle, lcFileIn, lnI

lcFileIn = ""
lnI 	 = 1

*** Open File for reading 
lnOHandle = FOpen( tcOpenFile )

*** Make sure that there is no file with soma name as second parameter
If File( tcFileName )
   Erase ( tcFileName )
Endif

*** Create a new file with name passd by second parameter
lnHandle = Fcreate( tcFileName )

*** Start reading first file and read it until not EOF
Do While Not FEof( lnOHandle )
   *** Read one line (to CR)
   lcFileIn = lcFileIn + FGets( lnOHandle)

   If !Empty(lcFileIn)
      *** Skip CR char
      lcFileIn = Left(lcFileIn, Len(lcFileIn) - 1 )
   Endif
   *** If you read 2 lines from First file
   If lnI % 2 = 0
      *** Truncate the line to be 151 chars if there are more
      If Len(lcFileIn) > 152
         lcFileIn = Left(lcFileIn, 151) + Chr(13)
      Endif

      *** Wrire to newly create file
      =Fwrite( lnHandle, lcFileIn )
      lcFileIn = ""
   Endif
   lnI = lnI + 1
Enddo
=FClose( lnOHandle )
=FClose( lnHandle )
I didn't find any sense in this code. Why you want (when I say you I mean that guy wrote this code) to loose data?
Also what happens with CHR(10) (if any)? But maybe someone else could explain better.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform