Difference between fprintf and fwrite?

42 vues (au cours des 30 derniers jours)
Ivana
Ivana le 25 Oct 2012
Commenté : David J. Mack le 18 Jan 2017
Hello, I am using a serial communication and I want to send some data. I was wondering what is the actual difference between the fprintf and fwrite function? Thanks!

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 25 Oct 2012
  • fprintf, write data to text file
  • fwrite, write data to binary file
  1 commentaire
David J. Mack
David J. Mack le 18 Jan 2017
To be really precise, fprintf writes data in text, fwrite in binary format, but both functions can write to the same (mixed-type) file.

Connectez-vous pour commenter.

Plus de réponses (1)

Sachin Ganjare
Sachin Ganjare le 25 Oct 2012
fprintf blocks the command line to execute other commands while the data is getting transferred while fwrite doesn't.
  4 commentaires
Sachin Ganjare
Sachin Ganjare le 25 Oct 2012
Ivana
Ivana le 25 Oct 2012
Thanks!!! :)

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by