I have written the following, and when I compile I get one recurring parse error that I cannot figure out what I have done. Would someone please take a look at it and see is they can find what I'm missing??? Here's the code. I am trying to create a simple grey box. {BTW: The UNIX system we use does not have a rasterfile.h, so we had to create the structure.}
Thanks in advance!
Sandy
Code:
#include<stdio.h>
struct rasterfile{
int ras_magic;
int ras_width;
int ras_height;
int ras_depth;
int ras_length;
int ras_type;
int ras_maptype;
int ras_maplength;
};
int imagesave(unsigned char);
main()
{
unsigned char img[500][500];
int i=0,j=0;
for(i=0; i<=500; i++)
for(j=0; j<=500; j++)
img[i][j] = 128;
imagesave(unsigned char img); /*here's where the parse error is - - -
parse error before unsigned*/
}
int imagesave(unsigned char img)
{
int fi;
int colormap[3][256];
struct rasterfile header;
fi = creat("testfile.ras", 0644);
header.ras_magic=0x59a66a95;
header.ras_width=500;
header.ras_height=500;
header.ras_depth=8;
header.ras_length=1;
header.ras_type=0;
header.ras_maptype=0;
header.ras_maplength=768;
write(fi, &header, sizeof(struct rasterfile));
write(fi, colormap, 256*3);
write(fi, img, header.ras_height*header.ras_width);
close(fi);
return (img);
}
Thanks Again!