博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
小程序分享:str1和str2对应的串相等, 但是a.txt和b.txt不相同。
阅读量:4141 次
发布时间:2019-05-25

本文共 410 字,大约阅读时间需要 1 分钟。

#include 
using namespace std;int main(){ char str1[100] = "ab\0cdddddddddd"; cout << str1 << endl; FILE *fa = fopen("a.txt", "wb"); fwrite(str1, sizeof(str1), 1, fa); fclose(fa); char str2[100] = "ab"; cout << str2 << endl; FILE *fb = fopen("b.txt", "wb"); fwrite(str2, sizeof(str2), 1, fb); fclose(fb); if(0 == strcmp(str1, str2)) { cout << "yes" << endl; } else { cout << "no" << endl; } return 0;}

转载地址:http://larvi.baihongyu.com/

你可能感兴趣的文章
九度:题目1012:畅通工程
查看>>
九度:题目1017:还是畅通工程
查看>>
九度:题目1034:寻找大富翁
查看>>
第六章 背包问题——01背包
查看>>
第七章 背包问题——完全背包
查看>>
51nod 分类
查看>>
1136 . 欧拉函数
查看>>
面试题:强制类型转换
查看>>
Decorator模式
查看>>
Template模式
查看>>
Observer模式
查看>>
高性能服务器设计
查看>>
性能扩展问题要趁早
查看>>
MySQL-数据库、数据表结构操作(SQL)
查看>>
OpenLDAP for Windows 安装手册(2.4.26版)
查看>>
图文介绍openLDAP在windows上的安装配置
查看>>
Pentaho BI开源报表系统
查看>>
Pentaho 开发: 在eclipse中构建Pentaho BI Server工程
查看>>
JSP的内置对象及方法
查看>>
android中SharedPreferences的简单例子
查看>>