Hey folks,
I've got another Problem.
I have to give out an array with textprintf_ex but it doesn't work like I wrote it:
Code:textprintf_ex(screen,font,table_x,table_y,makecol(255,255,255), -1,"%s", table[c][l]);
Hey folks,
I've got another Problem.
I have to give out an array with textprintf_ex but it doesn't work like I wrote it:
Code:textprintf_ex(screen,font,table_x,table_y,makecol(255,255,255), -1,"%s", table[c][l]);
People here aren't psychic (well, I shouldn't speak for others but I know I'm not ). "It doesn't work." is a tad generic. Please clarify.
Haha, sorry, I'm in a hurry and forgetting some esential things ;D
The compiling works fine and the programm starts.
But if the function starts and comes to the "textprintf_ex" it quits and I get an error report from Windows.
If I comment it out it works.
Then I suspect that table[c][l] contains garbage rather than a proper null-terminated string. Can you post a minimal example program? It's impossible to say where you're going wrong if all you show us is that one line.
My guess is table[c][l] is a char, not a string.
So perhaps print it as %c rather than %s.
Interpreting a single char as a char pointer (which %s will do) will almost certainly blow up.
You know, when windows halts a process due to memory violations, it usually prints the address.
If that address is 0x000000nn, then yes, you're taking a char as an address.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Yeey, that was it
Thank you so much.