Never name a C function read(), unless you’re trying to replace the system read() function. Maybe not a problem on Windows, I’m not sure, but definitely bad news on Unix or Linux.
I spent over an hour trying to figure out why libsndfile was claiming that it couldn’t recognize the format of a perfectly good .wav file.