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
;
}
查看全文
相关阅读:
最近工作
有点感受
日子有点快
IDEA配置spring
IDEA配置hibernate
mysql插入中文乱码
深夜配置一把struts2
IDEA 配置SSH2
找工作的事情
YTU 2509: 奇怪的分式
原文地址:https://www.cnblogs.com/wqj1212/p/1102482.html
最新文章
8种基本数据类型数组的默认值
数组的声明,初始化及遍历
break和continue的区别以及标签label的使用
程序优化--效率的计算
For循环输出九九乘法表
For嵌套输出图形
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 341
三相异步电动机能耗制动原理
AD20(AD19)---彻底解决原理图转PCB时,出现failed to add class member及Unknown Pin的问题
Java基础之集合
热门文章
Java中synchronized的使用实例
微信开发之使用java获取签名signature(贴源码,附工程)
利用CocoaHTTPServer实现wifi局域网传输文件到iphone
Nginx的负载均衡
Nginx的负载均衡
Nginx的负载均衡
Nginx的负载均衡
Nginx的负载均衡
Nginx的负载均衡
Spring中 @Autowired标签与 @Resource标签 的区别
Copyright © 2011-2022 走看看