讀
String userpath=application.getRealPath("/");
Properties prop = new Properties();
try {
FileInputStream fis = new FileInputStream(new File(userpath + "ini/desc.ini"));
prop.load(fis);
if (fis != null) {
fis.close();
}
} catch (Exception ex) {
System.out.println("打開文件出錯!");
}String sz等號右邊的內容=getStr(prop.getProperty("等號左邊的內容"));
String userpath=application.getRealPath("/");
Properties prop = new Properties();
try {
FileInputStream fis = new FileInputStream(new File(userpath + "ini/desc.ini"));
prop.load(fis);
if (fis != null) {
fis.close();
}
} catch (Exception ex) {
System.out.println("打開文件出錯!");
}String sz等號右邊的內容=getStr(prop.getProperty("等號左邊的內容"));
楼上说的只是打开一般文本文件的方法吧,我要的是针对INI文件的操作,如何操作INI文件3要素:小节,关键字,值。
看来我OUT了。
http://expert.csdn.net/Expert/TopicView1.asp?id=1985534