Can getc()/putc()/fgetc()/fputc() be used to read/write chars and floats rather than ints only from binary files? If so, how?
Kadence 0 Light Poster
Recommended Answers
Jump to PostYes you can use it, but I won't suggest it. Its a whole lot easier to use fread() and fwrite() to read/write to/from binary files.
// fgetc example float f = 0; unsigned char buf[sizeof(float)]; FILE* fp = fopen("myfile.dat", "rb"); // read a float for(i = 0; …
All 3 Replies
joshmo 8 Posting Whiz in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Kadence 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.