Results 1 to 3 of 3

Thread: หา Path File ที่ต้องการใช้ Delphi ทำไงครับ

  1. #1
    Member
    Join Date
    Dec 2004
    Location
    Thailand
    Posts
    30


    หา Path File ที่ต้องการใช้ Delphi ทำไงครับ

    ??? ไม่ทราบว่า Delphi สามารถ หา path File ที่ต้องการทำได้ยังไงครับ System.IO คืออะไรครับ
    มี code
    program Project1;
    {$APPTYPE CONSOLE}

    uses
    System.IO;

    var
    DirInfo : System.IO.DirectoryInfo;
    Path : String;
    Files : Array of FileInfo;
    i : Integer;

    begin
    // Get the current folder
    Path := System.IO.Directory.GetCurrentDirectory;
    Console.WriteLine('Files in : ' + Path + ' :');
    Console.WriteLine;

    // Create our directory info object
    DirInfo := System.IO.DirectoryInfo.Create(Path);

    // Get the files in this folder
    Files := DirInfo.GetFiles;

    // Display the files - just the file names that is
    for i := 0 to Length(Files)-1 do
    Console.WriteLine(Files[i].Name);

    Console.Readline;
    end.
    แต่Run แล้ว Error ที่ System.IO

  2. #2
    apegios
    Guest


    Re: หา Path File ที่ต้องการใช้ Delphi ทำไงครับ

    ที่คุณเอามาให้ดู
    มันเรียกดู โฟลเดอร์ กับไฟล์
    ไม่ใช้เหรอ

    ส่วน System.IO;
    คาดว่ามันเป็นไฟล์ ที่ต้องเอามาเพิ่มเอง
    มันไม่ใช้ไฟล์ ที่ Delphi มีมาให้

    หา Path มันต้อง
    เช่น c:/windows/system32
    ใช่ ป่าว
    ผมเองก้อไม่ค่อยเก่งหรอก
    program Project2;

    {$APPTYPE CONSOLE}

    uses
    windows;

    function GetSysDir():String;
    begin
    SetLength( Result, 260 );
    SetLength( Result, GetSystemDirectory( PChar( Result ), Length( Result ) ) );
    end;

    begin

    WriteLn(GetSysDir);
    WriteLn;
    Readln;
    end.

  3. #3
    Member
    Join Date
    Dec 2004
    Location
    Thailand
    Posts
    30


    Re: หา Path File ที่ต้องการใช้ Delphi ทำไงครับ

    :-) ขอบคุณนะครับที่ช่วยตอบครับ ขอบคุณมากๆครับ

Similar Threads

  1. Replies: 0
    Last Post: 01-10-2008, 09:32 AM
  2. Replies: 4
    Last Post: 25-01-2005, 12:17 PM
  3. Replies: 1
    Last Post: 07-01-2005, 01:36 PM
  4. Path on Symbian
    By labyrinth in forum Symbian C++, J2ME, Brew,XHTML
    Replies: 0
    Last Post: 01-12-2004, 09:43 AM
  5. Replies: 2
    Last Post: 12-02-2004, 09:25 AM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Who's Online (0)
0
0