-
as seen on Stack Overflow
- Search for 'Stack Overflow'
hi,
I have a problem in a C program of mine where after I use fread(), the file pointer goes to the end of the file sometimes.
I'll try to explain better - the code looks something like:
dummy = ftell(fp);
fread(&buf, sizeof(unsigned char), 8, fp);
dummy = ftell(fp);
where fp is a file pointer…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I've been working on this assignment, where I need to read in "records" and write them to a file, and then have the ability to read/find them later. On each run of the program, the user can decide to write a new record, or read an old record (either by Name or #)
The file is binary, here is its…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm writing a function to load a wave file and, in the process, split the data into 2 separate buffers if it's stereo. The program gets to i = 18 and crashes during the left channel fread pass. (You can ignore the couts, they are just there for debugging.) Maybe I should load the file in one pass…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The book Beginning Linux Programming (3rd ed) says
"Note that fread and fwrite are not recommended for use with structured data. Part of the problem is that files written with fwrite are potentially nonportable between different machines."
What does that mean exactly? What calls should I use…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hey, I'm really struggling with this one. I'am trying to port a small piece of someone else's code to Python and this is what I have:
typedef struct
{
uint8_t Y[LUMA_HEIGHT][LUMA_WIDTH];
uint8_t Cb[CHROMA_HEIGHT][CHROMA_WIDTH];
uint8_t Cr[CHROMA_HEIGHT][CHROMA_WIDTH];
} __attribute__((__packed__))…
>>> More