I didn't write the testEndian function myself, it was one I found on the internet. However, it does seem to work for me, returning 1 for my intel mac, and 0 for the unix server it is going to be...
Type: Posts; User: mash4t
I didn't write the testEndian function myself, it was one I found on the internet. However, it does seem to work for me, returning 1 for my intel mac, and 0 for the unix server it is going to be...
Yes, your test function works fine. It all gets swapped. But when I try with my actual image, I still get the 00006675 int, rather than the other way around.
Yes, but the function doesn't seem to do anything.
I'm pretty sure that I am getting the right .bmp, and the header doesn't seem to have changed. What should I be printing with the printf's?
Thanks for all the help. Managed to get it working. Turned out it was the length of longs and I was on a 64bit system.
I am writing a program which outputs a .bmp file, and was having trouble with the header. Thanks to the awesome help of the people here, that is all sorted now. However, I have another, I think more...
Sorry about the late replying, had a bit of a break for Christmas :P
I am getting a size of 112 for the struct with this:
typedef struct{
unsigned char bm[2];
unsigned long filesize;...
I've tried this:
#pragma pack(push, 1)
typedef struct{
unsigned char bm[2];
unsigned long filesize;
unsigned short reserved1;
unsigned short reserved2;
unsigned long headerSize;
Hmm, that doesn't seem to have made any difference either. The output in textedit looks the same as well. This is all very confusing...
(I meant changing it to short, will have a look at the other...
I probably should have put in my structures...
typedef struct {
char bm[2];
long filesize;
int reserved[2];
long headerSize;
long infoSize;
long width;
Changed it to wb, I still get the same result; the file refuses to open, I get the error message:
"The file generatedPattern.bmp could not be opened, It may be damaged or use a file format that...
I am trying to write a program that outputs a bmp file. The code compiles, and runs, but the .bmp won't open! Where am I going wrong?
Here is my code for generating the bitmap...
void...
Argh sorry stupid mistake - solved it.
Hi there.
I am trying to write a program that approximates the integral of Cos^2, by working out the area under the graph.
It was working on my home computer, running OSX, using GCC to compile,...