ReadIniTest_GetPrivateProfileString
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices; namespace ReadIniTest
{
class Class1
{
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, uint nSize, string lpFileName); public static string GetItemValueFromIniFile(string initFileName, string groupName, string itemName)
{
StringBuilder strBuilder = new StringBuilder();
uint cap=(uint)strBuilder.Capacity;
uint uRes = GetPrivateProfileString(groupName, itemName, "default", strBuilder, cap, initFileName);
Console.WriteLine("cap={0},uRes={1}", cap, uRes);//cap=500,uRes=499
return strBuilder.ToString();
}
}
}
ReadIniTest_GetPrivateProfileString的更多相关文章
随机推荐
- Python如何进行有背景图片的界面跳转
一.问题在进行tkinter点击按钮弹出新的界面的时候遇到了下面的问题:[_tkinter.TclError: image "pyimage2" doesn't exist] 原因 ...
- k8s创建pod和service的过程
一.概念介绍 更详细的参见:https://www.kubernetes.org.cn/5335.html 1.K8s K8s 是一种用于在一组主机上运行和协同容器化应用程序的系统,提供应用部署.规划 ...
- Remote System Explorer Operation总是运行后台服务,卡死eclipse解决办法
当你右键编辑控件的id或者其他属性时都会卡很久,发现原来是eclipse后台进程在远程操作,就是右下角显示的“Remote System Explorer Operation”.折腾了半天,在Stac ...
- java基础 接口常量
/** * 接口当中也可以定义"成员变量", 但是必须使用public static final三个关键字进行修饰 * 从效果上看,这其实就是接口的[常用] * 格式: * pub ...
- nlp学习杂记
什么是 token embedding? 输入一个word,在字典里查找得到它对应的下标就是token,然后用该数字下标去lookup表查找得到该词对应的词向量(词嵌入)就是embedding wor ...
- 【开发笔记】- 将MySQL数据库表中自增ID从0开始
命令: 用于清空某表的数据 且让自增的id重新从0开始 truncate table 你的表名
- AMD规范中模块id的命名规则
AMD 即 Asynchronous Module Definition, 中文是“ 异步模块定义”的意思. AMD 规范制定了定义模块的规则,这样模块和模块的依赖可以被异步加载. AMD 规范只定义 ...
- Thinkphp5.1允许uni-app的H5跨域请求接口解决方法
情景: uni-app使用vue框架开发混合APP,虽然APP或者小程序没有跨域,但希望就是写完这个既有H5,又有APP,小程序等,所以能通过后端解决跨域最好.但是不知道是vue的原因还是什么,在PH ...
- Tuple VS ValueTuple
深入理解 c# 元组与值元组(Tuple,ValueTuple) 为什么有此文章 首先要说的是我们公司内部技术框架是用 abp.vnext 框架整合而来的,我们架构师对于 abp 相关的知识都很了然于 ...
- 第一册:lesson 133.
原文: Sensational news. question:What reasons did Karen give for a wanting to retire? Have you just m ...