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
;
}
查看全文
相关阅读:
LeetCode 40. Combination Sum II
LeetCode 39. Combination Sum
#Python学习#python虚拟环境——virtualenv
#阿里云#云服务器部署Django(基础篇)
驱动调试之打印
Linux内核源码阅读记录一之分析存储在不同段中的函数调用过程
uevent机制
字符设备的另一种写法
DM9000C网卡驱动程序编写与测试
网卡驱动程序框架以及虚拟网卡驱动程序的实现
原文地址:https://www.cnblogs.com/wqj1212/p/1102482.html
最新文章
指针数组和数组指针
转载:Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
转载:OSG::Quat(四元数)用法
time_t和difftime
为项目添加CUDA支持
VS Code 对C++ 单文件、多文件(CMake工程) 配置文件
[转] C++ explicit关键字详解
Gedit —— 推荐于NOI系列考试(NOIlinux)的轻量编程环境
卡特兰数 — 计数的映射方法的伟大胜利
8.3-8.4NOIP模拟题总结
热门文章
P2649
逛公园 [NOIP2017 D1T3] [记忆化搜索]
禁止字符串 [POJ3691缩减版]
Bad Hair Day [POJ3250] [单调栈 或 二分+RMQ]
利用净现值(NPV)分析对比方案的可行性
LeetCode 367. Valid Perfect Square
LeetCode 81. Search in Rotated Sorted Array II
LeetCode 33. Search in Rotated Sorted Array
#阿里云#云服务器开放数据库本地连接
WIN10安装scrapy/channels等不成功的解决方式
Copyright © 2011-2022 走看看