Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 4075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!