fprintf.c as _ASSERTE(str != NULL) error

Started by
8 comments, last by Emmanuel Deloget 17 years, 1 month ago
I have the book "3D Game Engine Programming" by Stefan Zerbst. I run the chapters in the book. However, I get stuck with chapter 6 and 7. These chapters compiled good. But, when I run, it has an error in fprintf.c as _ASSERTE(str != NULL);. Does anyone have this book and happened to have the same problem as me. Or, know what is this error? I use Visual Studio 2003 and even 2005 both have the same problem. I did email the author but he hasn't been replied back! thanks!
Advertisement
Sound like you passed a NULL pointer in as a char* argument to one of the functions. Run in debug mode, when you get the assert hit "Retry" (or whatever it is to debug the program), then look back through the call stack and look at the variables you passed to the function.

In short, learn how to use the debugger...
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
Thanks for the hints, but the chapter is still not run! anyone have the book and having the same problem with me, please help! thanks all supports
Mayby there is an errata here:
http://stefan.zfx.info/3dgep.html

Good luck!
www.nextdawn.nl
Before I post the error, I went to the update page already. Thanks. Anyone else have same problem about this book please let me know. Thanks the all the help!
Anybody the same problem as I do about the book?
First of all, you are not supposed to keep on posting the same crap over and over again until somebody tells you to stop.

Second, you'd really increase your chance of getting an educated answer if you would go ahead and post relevant snippets of your code, instead of asking if somebody bought the same book as you did.

Ok! alright, I did not keep posting my problem. This is only the second time. I think if you can not help, then you don't need to say like that. However, cool down! and I am sorry about posting 2nd time of my problem in here which makes you getting upset about. Sorry everyone!!! I will not do this again! sorry...
Quote:Original post by dingdongdeng
Ok! alright, I did not keep posting my problem. This is only the second time. I think if you can not help, then you don't need to say like that. However, cool down! and I am sorry about posting 2nd time of my problem in here which makes you getting upset about. Sorry everyone!!! I will not do this again! sorry...


Riiight.

Look, we are all perfectly willing to help you, but you need to show us what you need help with.

If someone was doing some math work and said to you "what does 'x' equal?" and didn't show you the equation they started with, or what work they had done, would you be able to help them?

We are not magicians or mind-readers (Oluseyi and superpig excepted, of course [smile]), and can only help you with what you give us.

But here, I'll throw you a bone.

ASSERT is a macro which checks that whatever argument is provided to it is resolved to true at runtime. If not, the program crashes. Therefore, it should only be used for serious problems.

Now, 'str != NULL' indicates that a string or argument has been passed that does not point to anything. 'fprintf' cannot print something from nothing, so the assert crashes the program.

It looks like one of the arguments you passed (possible an argument to print out a string) is NULL, or you haven't passed the 'format' string which specifies the string and the position and type of all the arguments for 'fprintf' to output.

Give us a snippet of code and we can help you more. Else, don't complain.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
This answer targets Celvin, but some other person may also read this. The bottom line is: if you're not civil enough to avoid bluntness in your answer, don't answer.

Quote:Original post by Celvin
First of all, you are not supposed to keep on posting the same crap over and over again until somebody tells you to stop.

Second, you'd really increase your chance of getting an educated answer if you would go ahead and post relevant snippets of your code, instead of asking if somebody bought the same book as you did.


Firs of all, I want you to avoid bashing new users. I see nothing wrong with his behavior, except maybe a double post - which is not that dramatic. If you read more carefully, you'll see that most of his posts contains either "thanks" or "sorry".

Second, I see no value to this answer, as it's not civil and doesn't provide any usefull information. If you post to say nothing, don't post.

Third, this is quite a common formulation on gamedev. Someone buys a book, spots an error/issue in the code that he doesn't understand, and ask for the help of people who bought the same book. It already happened a lot, and will continue to happen. What make you think that it's not a valuable approach? Of course, it would have been better to get some small code snippet that would reveal the problem, but you surely know that you can ask this instead of replying in a blunt way.

Being blunt is not a solution, and this kind of behavior is quite difficult to accept, especially when it comes from someone who doesn't participate to any discussion. If you believe that some behavior is breaking the GDNet rules, click on the "report to a mod" link instead of acting like that.

Did I make my point clear?

@dingdongdeng: I'm also moving this thread to the "For Beginners" forum, where you should get more answers. You may also get better answers if you provide a code snippet that exhibits the problem. It seems that someone is feeding fprintf() (or a derivative: printf, sprintf,...) with a NULL string - what you could do to help us is to post the calling code, as Endar suggested.

This topic is closed to new replies.

Advertisement