Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I recognize a file to delete
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00573345
Message ID:
00573954
Vues:
23
Hi Sergey,

Actually, I don't understand the purpose of this code at all. If you have file and you want to create another file, in which you would have only 320 chars of each string in the first file (e.g. the rest is truncated), then this code is valid (with your corrections). Otherwise why do we need to copy record by record? Or do we want to copy until blank string is encountered?

>Hi Edgar,
>
>See my comments below
>
>>
>>>
>>>DIMENSION laFileList[1]
>>>lnFiles = ADIR(laFileList, "*.*")
>>>FOR i=1 TO lnFiles
>>>  ? laFileList[i, 1]   && File Name
>>>ENDFOR
>>>
>>>
>>
>>   gnOrigin = FOPEN(SubStr(cMedSearch,1,6)+laFileList[i, 1],1)
><b>* You have to check here if file was open  succcesfully
>   IF gnOrigin < 0
>     WAIT WINDOW NOWAIT '*** Could not open file! '
>     RETURN
>   ENDIF</b>
>
>>   gnFile = FCREATE('c:\'+cDestDirect+'\'+laFileList[i, 1]+cFileExt)
>>   IF gnFile < 0
>>    WAIT WINDOW NOWAIT '*** Could not create file! '+laFileList[i, 1]+cFileExt
>     =FCLOSE(gnOrigin)&& Close Original File
>      RETURN
>    ENDIF
>
>>    DO WHILE !FEOF(gnOrigin)
>       <b>* If logical record lenght is 320 than physical is 322 ( CR + LF)
>          * don't specify lenght at all, anyway FGETS reads until CR + LF</b>
>>      m.buffer = <b>FGETS(gnOrigin)</b>
>>      nFAIL=FPUTS(gnFile, m.buffer)
>>      IF nFAIL = 0
>>        nERRCNT= nERRCNT+ 1
>>        WAIT WINDOW NOWAIT "*** ERR WRITING RECORD "+laFileListA[i, 1]
>>        =FCLOSE(gnFile)  && Close NEW file
>>        =FCLOSE(gnOrigin)&& Close Original File
>>        RETURN
>>      ENDIF
>>    ENDDO
>
>>    =FCLOSE(gnFile)  && Close NEW file
>>    =FCLOSE(gnOrigin)&& Close Original File
>>
>>Sergey,
>>Can you help me see whats wrong with this code.
>>Infinit loop: value of buffer always blank -
>>All I want to do is read MedSearch and write to new Destination...
>>After that works I want to drop certain lines of the original text file
>
>Other than that I don't see any problems.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform