I have the following code which shows roughly what i am trying to do, I want to write error messages to the file using the write system call. I am having trouble assigning error messages to the buffer array as it shows errors, how do I make the code compile without errors?
Code:
#include <stdio.h>
int main()
{
char buffer[512];
int x = 1, y = 2;
if (x == 1)
{
buffer = 'hello';
printf("%s", buffer);
}
else
{
buffer = "bye";
printf("%s", buffer);
}
if (y == 2)
{
buffer = "hello2";
printf("%s", buffer);
}
else
{
buffer = "bye2";
printf("%s", buffer);
}
return 0;
}