About Fprint () and fwrite ()

Source: Internet
Author: User

int num = 12345;

Store 12345 as a binary number in num

1.

fprintf (FP, "%d", num); Write the binary code of the character ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ' into the file

2.

Fwrite (&num, sizeof (int), n, FP); The binary code of Value 12345 is written to the file, the data is divided into n blocks, each block is an int size,

  • FP specifies the file to write to.
  • &num Memory storage address for read-in file data
  • Fread () is the same as the parameter of the fwrite () function. (By using the fread () function, read the file data written by fwrite ())

About Fprint () and fwrite ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.