zoukankan
html css js c++ java
读,写数据
把数据写到文件中
//
把数据写到文件中
FILE
*
file
=
fopen(
"
文件名
"
,
"
wt
"
);
if
(file
==
NULL)
{
ShowInfoInSetUserSpace(
"
不能保存用户坐标系!
"
,ICON_ERROR);
}
fprintf(file,
"
%lf %lf %lf %lf\n%lf %lf %lf %lf\n%lf %lf %lf %lf\n%lf %lf %lf %lf
"
,
RTH[
0
][
0
],RTH[
0
][
1
],RTH[
0
][
2
],RTH[
0
][
3
],
RTH[
1
][
0
],RTH[
1
][
1
],RTH[
1
][
2
],RTH[
1
][
3
],
RTH[
2
][
0
],RTH[
2
][
1
],RTH[
2
][
2
],RTH[
2
][
3
],
RTH[
3
][
0
],RTH[
3
][
1
],RTH[
3
][
2
],RTH[
3
][
3
]);
fclose(file);
从文件中读数据
FILE
*
fin
=
fopen(SetFileName[FILE_USER_SPACE],
"
rt
"
);
if
(fin
==
NULL)
{
ShowInfo(
"
不能读取用户坐标空间参数,请先示教用户坐标系!
"
,ICON_ERROR);
return
;
}
fseek(fin,
0
, SEEK_SET );
fscanf(fin,
"
%lf %lf %lf %lf\n%lf %lf %lf %lf\n%lf %lf %lf %lf\n%lf %lf %lf %lf
"
,
&
UserCoordRelToRobot[
0
][
0
],
&
UserCoordRelToRobot[
0
][
1
],
&
UserCoordRelToRobot[
0
][
2
],
&
UserCoordRelToRobot[
0
][
3
],
&
UserCoordRelToRobot[
1
][
0
],
&
UserCoordRelToRobot[
1
][
1
],
&
UserCoordRelToRobot[
1
][
2
],
&
UserCoordRelToRobot[
1
][
3
],
&
UserCoordRelToRobot[
2
][
0
],
&
UserCoordRelToRobot[
2
][
1
],
&
UserCoordRelToRobot[
2
][
2
],
&
UserCoordRelToRobot[
2
][
3
],
&
UserCoordRelToRobot[
3
][
0
],
&
UserCoordRelToRobot[
3
][
1
],
&
UserCoordRelToRobot[
3
][
2
],
&
UserCoordRelToRobot[
3
][
3
]);
fclose(fin);
把数据写到文件中
#include
"
iostream.h
"
#include
"
fstream.h
"
void
main()
{
fstream outfile;
outfile.open(
"
1.txt
"
,ios::
out
);
outfile
<<
2
;
}
查看全文
相关阅读:
- (id)initWithCoder:(NSCoder *)decoder 的参数的作用
pch定义的宏,文件引用报错,use of undeclared identifier
tableView代理方法的调用时间,(主要是heightForRowAtIndexPath和cellForRowAtIndexPath调用时间)
Receiver 'NSManagedObjectContext' for class message is a forward declaration 错误的解决方案
delegate、notification、KVO的使用场景总结
UIGestureRecognizer手势和scrollview冲突的简单解决
CGAffineTransform中setTransform的几种类型以及注意事项
使用"vuedraggable"插件实现列表排序功能;
aliplayer的使用
自制时间轴组件封装
原文地址:https://www.cnblogs.com/wqj1212/p/1102482.html
最新文章
HTML学习随笔
本地项目上传到github 报错“master -> master (non-fast-forward)”
百度推送的证书上传问题
APP 加急审核 邮件
在UIWebView加载的页面, WF: _WebFilterIsActive returning: NO
RunLoop笔记之使用
RunLoop笔记
制作自己的Cocoapods
Cocoapods笔记
Bash笔记
热门文章
Git笔记
Dispatch Source
effective OC2.0 52阅读笔记(六 大中枢派发)+ Objective-C高级编程 (三Grand Central Dispatch)
objc阅读笔记-更轻量的view controllers
http header
UITextField
ReactiveCocoa
IMP功能报错的解决
Block在内存中的位置在arc和mrc的区别
GCD的相关总结
Copyright © 2011-2022 走看看