如何打印十六进制数字到文件? [英] How to print hex numbers to a file?
本文介绍了如何打印十六进制数字到文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前,我有一个while循环,用printf打印所有的数字控制台屏幕),但我需要它们在一个文件中。
解决方案
fprintf(fp ,%04x,your_number)
I am trying to store every hex value from 0000 to fffe into a file. How would I use fwrite or fprintf to place these values into a file?
At the moment, I have a while loop that prints all the numbers using printf (which is to the console screen), but I need them in a file.
解决方案
fprintf(fp, "%04x", your_number)
这篇关于如何打印十六进制数字到文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文