Re: [fpc-pascal] Adding files to a tar file

2014-01-21 Thread waldo kitty
On 1/21/2014 7:45 PM, luciano de souza wrote: The program compiles, but I got an error. The message says that the first file of the directory can't be opened. What is wrong? your code uses faAnyfile... perhaps you need to be more restrictive? is your problem caused by a sub-directory with the

Re: [fpc-pascal] Adding files to a tar file

2014-01-21 Thread luciano de souza
Yes, that's the mistake. I forgot the fact "search.name" does not returns a full path. This code works very well. program e01; {$mode objfpc}{$H+} uses libtar, sysutils; var archive: TTarWriter; search: TSearchRec; path: string; BEGIN archive := TTarWriter.create('arquivo.tar'); with archive do

Re: [fpc-pascal] Adding files to a tar file

2014-01-21 Thread Flávio Etrusco
On Tue, Jan 21, 2014 at 10:45 PM, luciano de souza wrote: > Hello all, > > This code should add all the files of a directory in a tar file. > > program e01; > {$mode objfpc}{$H+} > > uses > libtar, sysutils; > > var > archive: TTarWriter; > search: TSearchRec; > > BEGIN > archive := TTarWriter.cre

[fpc-pascal] Adding files to a tar file

2014-01-21 Thread luciano de souza
Hello all, This code should add all the files of a directory in a tar file. program e01; {$mode objfpc}{$H+} uses libtar, sysutils; var archive: TTarWriter; search: TSearchRec; BEGIN archive := TTarWriter.create('arquivo.tar'); with archive do begin try FindFirst('/home/luciano/Documentos/*',