log檔案的讀並寫入 text檔案

2021-06-03 05:10:02 字數 864 閱讀 9255

今天要寫乙個功能的**,讀.log檔案並去相關字段寫入.txt 。在此做個筆記!

public const string readfilepath = "c:\\documents and settings\\admin\\桌面access_20111207.log";

public const string writefilepath = "c:\\documents and settings\\admin\\桌面\\log.txt";

public static arraylist al;

static void main(string args)

//else//}

public static void readpath(string path)}}

public static void readlog(string filepath)

if (childstr[8].contains("\"") == false)

sumnum += convert.todouble(childstr[9])/(1024 * 1024);

textstr = sr.readline();

} if (file.exists(writefilepath))

else

}catch (exception e)

}public static void writetext(string name, int totalip, double totalnum)

public static bool dealwithip(string ipstr)

al.add(ipstr);

return true;

}}

監聽Log 並寫入檔案

public class notelog public static void stopnotelog private static void startnotelogthread catch ioexception e finally readlogthread.start private sta...

如何控制工程中的LOG資訊,並寫入檔案

02 tflog.h 03 04 created by tom fewster on 08 06 2010.05 06 07 if target os iphone target iphone simulator 08 import 09 else 10 import 11 endif 12 13 ...

python之獲取目錄下的檔名並寫入檔案

背景 為了統計乙個目錄下所有檔名,並且寫到檔案中 工具 python的模組os.walk 功能 遍歷目錄下的所有子檔案及其子資料夾,如果有子資料夾的話,會繼續以子資料夾為目錄遞迴遍歷 返回 如果只有檔案的話,只返回乙個元組 當前目錄字串,資料夾名列表,檔名列表 如果還有資料夾的話,返回多個元組 co...