FreePascal filenames to text files

Hello all,
I am attempting to write a program that takes the filenames of a number of files in a folder and sends the filenames to a text file. I am using freepascal compiler, can anyone help me?

Comments

  • [code][color=Blue]{ Compiler FPC v.2.4.0 }
    uses dos;

    var rec:searchrec;
    t:text;
    i:longword;

    begin
    assign(t,'Files in current folder.txt');
    rewrite(t);
    i:=0;
    findfirst('*.*',archive+hidden+sysfile,rec);
    while doserror=0 do begin
    writeln(t,rec.name);
    findnext(rec);
    inc(i);
    end;
    writeln(t,#13#10,i,' files');
    close(t);
    end.
    [/color][/code]
  • thank you so much! Do you mind explaining your code, i'm kind of a beginner :D
    Thanks again
  • : thank you so much! Do you mind explaining your code, i'm kind of a
    : beginner :D
    : Thanks again
    :

    Try some tutorials first, there are quite a few if you google them. Also read the manual (help), it explains every line in detail and even has examples.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories