写一个整数与一个的fputs文件() [英] Writing an integer to a file with fputs()

查看:174
本文介绍了写一个整数与一个的fputs文件()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是不可能做这样的事的fputs(4 fptOut); ,因为的fputs不喜欢整数。我该如何解决此问题?

It's not possible to do something like fputs(4, fptOut); because fputs doesn't like integers. How can I work around this?

的fputs(4,fptOut); 是不是一种选择,因为我有一个计数器值工作

Doing fputs("4", fptOut); is not an option because I'm working with a counter value.

推荐答案

什么

fprintf(fptOut, "%d", yourCounter); // yourCounter of type int in this case

fprintf中 的文档可以在这里一>

这篇关于写一个整数与一个的fputs文件()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆