Hi! As you can see by my name I'm new to programming. I have a program that only works partially. It consists of two functions. One function creates a text file and reads it and the other one creates a binary file and reads it. The text file part works fine, but the binary part doesn't. It seems to create a file and write the contents but it doesn't read. So my question is why doesn't it read the contents of the file I created?
Thanks in advance!

Recommended Answers

All 3 Replies

How do you expect it to work when you write "complex" into file, and try to get "float" out of it?

>fread (&temp,amount*sizeof( *z_array ), 1 ,binaryfile);
temp is a float. Read your reference on fread again, double check the actual values you're passing it, and you'll see a problem.

Thanks for your help!
It works! :icon_cheesygrin:

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.