
需要改后缀名:用自带的记事本或安装的word打开更改后缀为.docx的ini文件,编辑完成后,重新更改后缀为.ini。
Mac OS X 在磁盘下的应用程序文件夹或Launchpad(Mac OS X Lion 10.7或以上)中找到文本编辑.app(源名称:TextEdit.app),打开后就可以新建文稿并实施编辑。
文本编辑支持多信息文本格式(.rtf)、带附件的多信息文本格式(.rtfd)、(.html)、Web归档(.webarchive)、OpenDocument 文本(.odt)、Word 2007 格式(.docx)、Word 2003 格式(.xml)。
扩展资料:
有些文本编辑器短小精悍,也有些文本编辑做败器提供了丰富、复杂的功能。例如,Unix和类Unix *** 作系统都提供了vi编辑器(或者是它的变种)纯野颤,但是也有部分 *** 作系统提供了Emacs编辑器。Windows系统提供了非常简单的记事本。
但是很多人,尤其是那些程序员们却更脊厅喜欢Windows下功能更丰富的其它编辑器。在Apple Macintosh的经典Mac OS中,包含了SimpleText,后来,TextEdit替代了它。有些编辑器支持两种 *** 作模式,既可以当做文本编辑器,又可以当做文字处理器,WordStar就是一例。
参考资料来源:百度百科-文本编辑器
android编程iniini文件读写的方法为:
一.将信息写入.INI文件中
1.所用的WINAPI函数原型为:
BOOL WritePrivateProfileString(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
LPCTSTR lpString,
LPCTSTR lpFileName
)
其中各参数的意义:
LPCTSTR lpAppName 是INI文件中的一个字段名.
LPCTSTR lpKeyName 是lpAppName下的一个键名,通俗讲就是变量名.
PCTSTR lpString 是键值,也就是变量的值,不过必须为LPCTSTR型或CString型的.
LPCTSTR lpFileName 是完整的INI文件名.
2.具体使用方法:设现有一名学生,需把他的姓段并中名和年龄写入 c:/stud/student.ini 文件中.
CString strName,strTemp
int nAge
strName="张三"
nAge=12
::WritePrivateProfileString("StudentInfo","Name",strName,"c://stud//student.ini")
此时c:/stud/student.ini文件中的内容如下:
[StudentInfo]
Name=张三
.要将学生的年龄保存下来,只需将整型的值变为字符型即可:
strTemp.Format("%d",nAge)
::WritePrivateProfileString("StudentInfo","Age",strTemp,"c://stud//student.ini")
二.将信息从INI文件中读入程序中的变量.
1.所用的WINAPI函数原型为:
DWORD GetPrivateProfileString(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
LPCTSTR lpDefault,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName
)
其中各参数的意义:
前二个参数与 WritePrivateProfileString中的意义一样.
lpDefault : 如果INI文件中没有前两个参数指定的字段名或键名,则将此值赋给变量.
lpReturnedString : 接收INI文件中的值的CString对象,即目的缓存器.
nSize : 目的缓蔽衡存器的大小.
lpFileName : 是完整的INI文件名.
2.具体使用方法:现要将上一步中写入的学生的信息读入程序中.
CString strStudName
int nStudAge
GetPrivateProfileString("StudentInfo","Name","默认姓名",strStudName.GetBuffer(MAX_PATH),MAX_PATH,"c://stud//student.ini")
执行后 strStudName 的值为:"张三握山",若前两个参数有误,其值为:"默认姓名".
3.读入整型值要用另一个WINAPI函数:
UINT GetPrivateProfileInt(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
INT nDefault,
LPCTSTR lpFileName
)
这里的参数意义与上相同.使用方法如下:
nStudAge=GetPrivateProfileInt("StudentInfo","Age",10,"c://stud//student.ini")
三.循环写入多个值,设现有一程序,要将最近使用的几个文件名保存下来,具体程序如下:
1.写入:
CString strTemp,strTempA
int i
int nCount=6
file://共有6个文件名需要保存
for(i=0i {strTemp.Format("%d",i)
strTempA=文件名
file://文件名可以从数组,列表框等处取得.
::WritePrivateProfileString("UseFileName","FileName"+strTemp,strTempA,"c://usefile//usefile.ini")
}
strTemp.Format("%d",nCount)
::WritePrivateProfileString("FileCount","Count",strTemp,"c://usefile//usefile.ini")
2.读出:
nCount=::GetPrivateProfileInt("FileCount","Count",0,"c://usefile//usefile.ini")
for(i=0i {strTemp.Format("%d",i)
strTemp="FileName"+strTemp
::GetPrivateProfileString("CurrentIni",strTemp,"default.fil", strTempA.GetBuffer(MAX_PATH),MAX_PATH,"c://usefile//usefile.ini")
file://使用strTempA中的内容.
}
补充四点:
1.INI文件的路径必须完整,文件名前面的各级目录必须存在,否则写入不成功,该函数返回 FALSE 值.
2.文件名的路径中必须为 // ,因为在VC++中, // 才表示一个 / .
3.也可将INI文件放在程序所在目录,此时 lpFileName 参数为: ".//student.ini".
4.从网页中粘贴源代码时,最好先粘贴至记事本中,再往VC中粘贴,否则易造成编译错误,开始时我也十分不解,好好的代码怎么就不对呢?后来才找到这个方法.还有一些代码中使用了全角字符如:<,\等,也会
造成编译错误.
package com.hangcheng.util
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
import java.util.ArrayList
import java.util.HashMap
import java.util.List
import android.app.Activity
import android.content.Context
import android.content.res.AssetManager
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)