usezara怎么读读

在我们写的程序当中,总有一些配置信息需要保存下来,以便完成程序的功能,最简单的办法就是将这些信息写入INI文件中,程序初始化时再读入.具体应用如下:
  一.将信息写入.INI文件中.
  1.所用的WINAPI函数原型为:
  BOOL WritePrivateProfileString(
  LPCTSTR lpAppName,
  LPCTSTR lpKeyName,
  LPCTSTR lpString,
  LPCTSTR lpFileName
  其中各参数的意义:
  LPCTSTR lpAppName 是INI文件中的一个字段名.
  LPCTSTR lpKeyName 是lpAppName下的一个键名,通俗讲就是变量名.
  LPCTSTR lpString 是键值,也就是变量的值,不过必须为LPCTSTR型或CString型的.
  LPCTSTR lpFileName 是完整的INI文件名.
  2.具体使用方法:设现有一名学生,需把他的姓名和年龄写入 c:/stud/student.ini 文件中.
  CString strName,strT
  int nA
  strName="张三";
  nAge=12;
  ::WritePrivateProfileString("StudentInfo","Name",strName,"c://stud//student.ini");
  此时c:/stud/student.ini文件中的内容如下:
  [StudentInfo]
  Name=张三
  3.要将学生的年龄保存下来,只需将整型的值变为字符型即可:
  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 strStudN
  int nStudA
  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 nCount=6;
  文件://共有6个文件名需要保存
  for(i=0;i {strTemp.format("%d",i);
  strTempA=文件名;
  文件://文件名可以从数组,列表框等处取得.
  ::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=0;i {strTemp.format("%d",i);
  strTemp="FileName"+strT
  ::GetPrivateProfileString("CurrentIni",strTemp,"default.fil", strTempA.GetBuffer(MAX_PATH),MAX_PATH,"c://usefile//usefile.ini");
  文件://使用strTempA中的内容.
  补充四点:
  1.INI文件的路径必须完整,文件名前面的各级目录必须存在,否则写入不成功,该函数返回 FALSE 值.
  2.文件名的路径中必须为 // ,因为在VC++中, // 才表示一个 / .
  3.也可将INI文件放在程序所在目录,此时 lpFileName 参数为: ".//student.ini".
  4.从网页中粘贴源代码时,最好先粘贴至记事本中,再往VC中粘贴,否则易造成编译错误,开始时我也十分不解,好好的代码怎么就不对呢?后来才找到这个方法.还有一些代码中使用了全角字符如:<,\等,也会造成编译错误.
为了您的安全,请只打开来源可靠的网址
CString StrN&::GetPrivateProfileString(strSection, strEntry, L"false", StrName.GetBuffer(128), 128, strIniPath);&StrName.ReleaseBuffer(); //如果不写这一句,那么StrName.GetLength()=0,所以非常重要
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:64112次
积分:1560
积分:1560
排名:第10731名
原创:90篇
转载:26篇
(1)(11)(3)(3)(13)(1)(1)(2)(2)(1)(4)(4)(4)(14)(7)(3)(7)(5)(5)(4)(2)(3)(3)(13)Book to use square hate less怎么读_百度知道
Book to use square hate less怎么读
我有更好的答案
按默认排序
布克 吐 油日 斯国诶儿 黑特 累斯
其他类似问题
less的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁use怎么读_百度知道
要中文谐音
提问者采纳
U(英文字母中的u发音)思
其他类似问题
按默认排序
其他8条回答
1,柚子 用作动词时
2.又似 用作名词时
两个读音 “use”在英汉词典中的解释use1 vt. 1. 用,使用 2. 发挥;行使 3. 耗费 4. 利用(他人、时间、机遇等) 5. 对待[O] vi. 1. (现仅用于used to do结构)过去惯常,以前习惯于 use2 n. 1. 用,使用;利用[S][U][(+of)] 2. 使用权;使用能力[U][(+of)] 3. 用途,功能[C][U] 4. 效用;益处;价值[U] 5. 用法[S][U] 6. 【律】受益;受益权
/ju:s/ 鱼死
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁当前位置:
>>>阅读理解 Different people use different languages. We Chine..
&&&& Different people use different languages. We Chinese speak Chinese, and, most of us are learning a foreign language. But there is another kind of language we need to know - the language of the body.&&& All over the world, people "talk with their hand, with their heads and with their eyes." When Japanese people meet, they bow. When Indians meet, they put their hands together. What do American and British do? Americans are more informal than the British. They like to be friendly. They use first names, they ask questions and they talk easily about themselves. When they sit down, they like to relax in their chairs and make themselves comfortable. British people are more reserved(保守的). They take more time to make friends. They like to know you before they ask your name.&&&& When British or American people meet someone for the first time, they shake hands. They do not usually shake hands with people they know well. Women sometimes kiss their women friends, and men kiss women friends (on one cheek only). When a man meets a man, he just smiles, and says, "Hello." Men do not kiss each other, or hold hands. Even fathers and sons do not often kiss each other.1. In the passage, the writer thinks that body language is ______________.A. useless&&&& B. difficult&&&&C. quite easy&& D. important2. Which of the following is right?A. different countries have the same body language.B. different countries have different body languages.C. people in Asia share the same body language.D. many people only use their body language.3. If an American friend visits you, he probably _____________.A. sit straight&&&&B. never sits down&& C. makes fun of you&& D. sits freely4. If you want to make a British friend, you may feel it ___________.A. impossible&&&&B. too easy&&&&&&&& C. too difficult&&&&&& D. slow
题型:阅读理解难度:中档来源:贵州省期末题
马上分享给同学
据魔方格专家权威分析,试题“阅读理解 Different people use different languages. We Chine..”主要考查你对&&历史文化类阅读&&等考点的理解。关于这些考点的“档案”如下:
现在没空?点击收藏,以后再看。
因为篇幅有限,只列出部分考点,详细请访问。
历史文化类阅读
什么是历史文化类阅读:
本类题型常用的方式是夹叙夹议。叙述的目的是为了议,所以要把握其议才是主要方面。阅读这类文章,先弄清其引入的话题,再弄清里面人物对其不同的看法,然后理解作者本身对话题的观点看法或思考。 历史文化类阅读技巧:
【题型说明】历史文化类阅读理解文章属高考常选材料之一。这类文章常涉及历史、文化、法制、宗教等方面的文学艺术、发明创造、文化遗产保护、宗教与文化、风俗与习惯、道德与法制、中外文学名著节选、等等。这类材料的命题点往往落在主旨大意题、事实细节题上。 【答题方法】在做这类阅读理解题时,我们应注意以下几个方面: 1、采用先题后文:先读题目,再带着问题读文章。这类阅读理解文章相对来说事实细节题稍多一点,如果带着问题读文章,有利于我们抓细节。 2、先做细节题。因为做完了局部性的事实细节题后,自然会加深我们对文章的理解,这样更有利于做主旨大意题。 3、重点敲定主旨题。主旨大意题提问的形式主要有两大类:一类是Main idea型;一类是Topic或Title型。在解答这类试题时应注意以下几点: a.读首句抓大意。文化教育类阅读理解文章多采用说明文、议论文体裁,而这类文章大都采用文章段落的中心,即主题句在文章开头。因此,要寻找这类文章的主旨大意就需要研究文章的首句。 b.读尾句抓大意。有时这类文章的主题句安排在文章的结尾,作为对全篇的总结。 c.读首段抓大意。有些文章或段落的开头和结尾部分都有主题句。这种结构是为了突出主题思想而使用两次点题的写作方法。这两个主题句在句子结构和用词上有所不同,而且在内容上前句和后句也不重复。 d.从段落中抓大意。有些文章或段落的主题句在文章中,这种文章或段落往往以一句话或几句话引出要表达的主题,在主题句出现后,再举例子陈述细节或继续论证。 e.归纳要点抓大意。有些文章或段落无明显的主题句,只是暗示性地体现主题。这就要求同学们在阅读过程中根据文中所叙述的事实或线索来概括总结主旨大意。
发现相似题
与“阅读理解 Different people use different languages. We Chine..”考查相似的试题有:
443999177428181609210754190719202964

我要回帖

更多关于 zara怎么读 的文章

 

随机推荐