![]() there's an easy way to do a sanity check. Write_ptr = fopen("test.bin","wb") // w for write, b for binaryįwrite(buffer,sizeof(buffer),1,write_ptr) // write 10 bytes from our buffer Writing to a file is pretty much the same, with the exception that you're using fwrite() instead of fread(): FILE *write_ptr Printf("%u ", buffer) // prints a series of bytes keep in mind that when you "output" this data, you're not reading ASCII, so it's not like printing a string to the screen: for(int i = 0 i<10 i++) You said you can read it, but it's not outputting correctly. ![]() ![]() Ptr = fopen("test.bin","rb") // r for read, b for binaryįread(buffer,sizeof(buffer),1,ptr) // read 10 bytes to our buffer Reading and writing binary files is pretty much the same as any other file, the only difference is how you open it: unsigned char buffer
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |