读ini配置文件value值长度有限制?

fky1989 2017-11-08 02:54:55
[GetScheduling]
InParamStr=1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
最长这么长?再多一个字符就报错了,如果有限制,那么还有什么好办法记录长配置信息?我是想记录存储过程的输出参数
OutParamStr=PlanID,s|WorkDate,s|RegTypeCode,s|RegTypeName,s|DeptCode,s|DeptName,s|DoctorWorkNum,s|DoctorName,s|Morning,s|MCan,int32|MRegister,int32|Afternoon,s|ACan,int32|ARegister,int32|Night,s|NCan,int32|NRegister,int32|VisitPosition,s|Price,decimal

private string ContentValue(string Section, string Key)
{
StringBuilder temp = new StringBuilder();
GetPrivateProfileString(Section, Key, "", temp, 2048, iniFilePath);
return temp.ToString();
}
...全文
1483 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
明心正行 2019-08-06
  • 打赏
  • 举报
回复
比较好奇一些软件的log日志文件是怎么做的
XBodhi. 2019-08-04
  • 打赏
  • 举报
回复
推荐在用 ini 文件了,现在推荐你用 json 或是 xml 都比这个方便。
秋的红果实 2019-08-03
  • 打赏
  • 举报
回复
ini本身没听说有限制,估计是读取的问题 OutParamStr这个是什么? 怎么读取的?
leon51 2019-08-03
  • 打赏
  • 举报
回复
我也是前两天刚发现确实有长度限制的,可以试试xml
stherix 2019-08-02
  • 打赏
  • 举报
回复
StringBuilder默认的Capacity不够,你要手动初始化大缓冲区 ini文件本身对行的大小没有严格限制 或者你也可以换json来存储配置
zj_zwl 2019-08-02
  • 打赏
  • 举报
回复
有长度限制的,建议采用其他方式保存
良朋 2019-08-02
  • 打赏
  • 举报
回复
这玩意读写很慢的,如果你频繁读写,有这么长,不建议用这个。
鬼1 2019-08-01
  • 打赏
  • 举报
回复
private string ContentValue(string Section, string Key) { StringBuilder temp = new StringBuilder(2048); GetPrivateProfileString(Section, Key, "", temp, 2048, iniFilePath); return temp.ToString(); } 这样即可,今天刚好有碰到这个问题
帅猪儿 2017-11-08
  • 打赏
  • 举报
回复
那你就不要放到ini配置文件中就行了呗,如果是长字符串就放到txt文件中,或者如果是有规则的文件就放到xml中。然后按照file.exist()判断后读取文件中的内容就行了,读取之后可以删除文件或者文件中的内容。
by_封爱 版主 2017-11-08
  • 打赏
  • 举报
回复
没道理吧.. ini就是有规则的txt而已.... 不就是等号分割吗...

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧