之前,用标准C++写过读取文件夹.现在用QT重写代码,顺便看了下QT如何实现,还是相当简单的.主要用到QDir,详细文档可见这里 A program that lists all the files in the current directory (excluding symbolic links), sorted by size, smallest first: ? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 #in
本地路径的创建 在做下载操作时,我们一般先把文件下载到本地指定的路径下,然后再做其他使用. 为了防止程序出现异常,我们通常需要先判断本地是否存在指定的路径. 以C盘Tmp文件夹为例,我们可以这样做,代码如下: if not DirectoryExists('C:\Tmp') then if not CreateDir('C:\Tmp') then raise Exception.Create('Opps, Create New Dir Failed!'); 清空本地指定文件夹下的文件 以C盘Tm
FolderForm.cs的代码如下: using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using System.Windows.Forms; namespace HoverTree.Hewenqi { public partial class FolderForm : Form { public FolderForm() {