Original Post
I''m sorry to bother you again with this but this just drives me crazy! So I beg you to pleeeeaaaze have a look at this and help me if possible.
I have the following code:
There are quite a few variables declared outside the function, so don''t bother about the declarations. They are all declared.
The code compiles fie without errors and wanrings but when I execute it, I get an assertion error from vsprintf.
If it is of interest, the message gives these infos:
File: vsprintf.c
Line: 90
Expression: string != NULL
What the hell is wrong?
Can you help me? Pleaaaaaazze! I''m desperate!
"Mr Sandman bring me a dream"
void WriteStringToFrame(Frame frame, const char *String, ...)
{
va_list argument;
int counter;
char *buffer;
CHAR_INFO *str;
buffer = new(char[frame.Size.X * frame.Size.Y]);
str = new(CHAR_INFO[frame.Size.X * frame.Size.Y]);
memset(&buffer, 0, sizeof(buffer));
memset(&str, 0, sizeof(str));
va_start(argument, String);
vsprintf(buffer, String, argument);
va_end(argument);
for (counter = 0; counter <= sizeof(buffer); counter++)
str[counter].Char.AsciiChar = buffer[counter];
for (counter = 0; counter <= sizeof(buffer); counter++)
str[counter].Attributes = Color;
WriteConsoleOutput(
hOutput,
str,
frame.Size,
frame.Pos,
&frame.Rect);
};
|