function Pipe2Comma lparameters lcFileName,lcOutFile handlein = fopen(lcFileName) && Open input file lnSize = fseek(handlein,0,2) && Get size * fseek(filehandle, 0, 2) seeks to EOF * and returns byte offsett which is filesize =fseek(handlein,0,0) && Reset file pointer to byte offsett 0 - BOF handleout = fcreate(lcOutFile) && Create output file lcContent = fread(handlein, lnSize) && Read content to a string lcPipe2Comma = chrtran(lcContent, "|", ",") && Convert pipes to commas =fwrite(handleout, lcPipe2Comma, lnSize) && Write to output file * In previous version above 3 lines were combined to one line =fclose(handlein) && Close files =fclose(handleout)Cetin
lcFileName = "mytext.txt" >>lcOutFile = "myouttext.txt" >>handlein = fopen(lcFileName) >>lnSize = fseek(handlein,0,2) && Get size >>=fseek(handlein,0,0) && Rewind to top >>handleout = fcreate(lcOutFile) >>=fwrite(handleout, chrtran(fread(handlein, lnSize), "|",","), lnSize) >>=fclose(handlein) >>=fclose(handleout)In VFP6 you could also use FILETOSTR() and STRTOFILE().