I am having some trouble in the following code :
void bufferwrite(RGBTRIPLE rgb, RGBTRIPLE* buffer, int n, int padding)
{
fwrite(&rgb, sizeof(RGBTRIPLE), n, buffer);
for(int i = 0; i < padding; i++)
{
fputc(0x00, buffer);
}
}
And the following error :
Error: incompatible pointer types passing 'RGBTRIPLE *' to parameter of type
'FILE *' (aka 'struct _IO_FILE *')
[-Werror,-Wincompatible-pointer-types]
fwrite(&rgb, sizeof(RGBTRIPLE), n, buffer);
^~~~~~
/usr/include/stdio.h:716:38: note: passing argument to parameter '__s' here
size_t __n, FILE *__restrict __s);
^
resize.c:151:21: error: incompatible pointer types passing 'RGBTRIPLE *'
to parameter of type 'FILE *' (aka 'struct _IO_FILE *')
[-Werror,-Wincompatible-pointer-types]
fputc(0x00, buffer);
^~~~~~
/usr/include/stdio.h:573:34: note: passing argument to parameter '__stream' here
extern
int fputc (int __c, FILE *__stream);
^
So I understand the error here that I am passing a RGBTRIPLE pointer as argument instead of a FILE* pointer.
So my question here is that if I want to write to a RGBTRIPLE buffer array, then what should I do.