Thanks for the replies guys, @Click_here there is an if statement checking to see if fp exists there, and it prints out the values correctly so it does read it.
@Salem thankyou for that im not...
Type: Posts; User: igor
Thanks for the replies guys, @Click_here there is an if statement checking to see if fp exists there, and it prints out the values correctly so it does read it.
@Salem thankyou for that im not...
[QUOTE=christop;1122134]These three lines are a buffer overflow. array[13] does not exist. It is one char past the end of the array.
you're a legend! thanks so much for you're help!
Here is the code;
char filename[20];
FILE *image;
header data;
unsigned char array[13];
printf("Enter File Name: \n");
Ive read a .BMP file correctly, getting the width height and image offset data where the image files begin. i now need to read the struct containing the imagecomponents of the image (blue green and...
ahh okay, worked it out thanks a lot!! :D all seems to work fine (from the first 2 structures) on both little and big endien - EXCEPT one member, imagedataoffset is getting different results when...
thanks a lot - and yeah im aware of the few little issues (with fread before open and %d instead of %u for unsigned int - though that was just a quick test to see if i was getting right values and...
Thanks for your reply. Regarding using int in the structs - this is the format given in the assignment outline, so i have no choice ;)
I attempted to use #pragma pack (just for the 1 structure)...
so back on topic :P as stated in post 5 is the format of a bmp file, specified in the outline - what would be the best way to read the file? I can read the file using the first structure - however am...
I wish it was that easy - unfortunately as a first year electrical engineer at university we are required to undertake a C programming course - this is an assignment. Seems like quite a difficult one...
Hi Salem, thanks a lot for your assistance - the file format is the following;
File Header > Info Header > Image Data
with the structure as follows:
insert
typedef struct ...
Ohok thanks man heres what im up to so far, not sure if thats right but... it gets the B and M right though
#include <stdio.h>
/* structs */
typedef struct
{
unsigned char fileMarker1;...
not 100% sure how im meant to read the image file and verify the first two cahracters are 'B' and 'M'
using this struct:
typedef struct
{
unsigned char fileMarker1; /* 'B' */
unsigned char...
Thank you so much for your answer :) cleared up a few issues.
i dunno haha, its an assessment and am supposed to open/read the file.
If the file is opened successfully, the program shall display the following message "U coded data" ( or P coded data )and...
thanks for your help...my main problem at the moment is actually trying to print the data from a .d file. This is just a sample of what i've done so far (i know error recovery methods and stuff are...
My program prompts the user to enter a file name and
open the specified file.
If the file is not found,the file format is not unsigned binary file U or the file size stores more than 64 values...