Writing an integer to a file with fputs()

前端 未结 4 1390
终归单人心
终归单人心 2021-01-04 13:21

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

Doing fputs(\"4\", fpt

4条回答
  •  借酒劲吻你
    2021-01-04 13:39

    What about

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

    Documentation of fprintf can be found here.

提交回复
热议问题