Thread: Tips for me on my source

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    41

    Thumbs up Tips for me on my source

    I have my program half done it stors and enters cheat codes and stuff like that. I just want someone to look at my source code and give tell me what's wrong, what i'm doing right, and stuff like that. So if anyone has the time please look at it and give me some tips. There's 850 lins or so. There also is a problem in the history functions at the way end and i cant find out the problem and i fix some other erros so here's an update to it now. The fuctions keep printing out the same thing over and over for some reason. I had this happen to me once but I fixed it but now i forget.
    And there's also a problem on the exit function when They enter y to say yes to exit it brings them to some other function. Well i'm going to go to bed now.
    Last edited by smog890; 06-03-2002 at 02:39 AM.
    Shouldent NULL be, 78, 85, 76, 76, or just 0 or, 4E, 55, 4C, 4C

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    > fflush(stdin);
    This is undefinded and you should not use it. This should tell you why: http://www.eskimo.com/~scs/C-faq/q12.26.html

    > scanf
    Instead of using scanf I would use fgets. If you need a numerical value then you can use atoi like this.
    Code:
    fgets(Input, MAX_AMOUNT, stdin);
    Integer = atoi(Input);
    You might also want to create your own header file for main.c. You can use it for your protypes and any definitions. I personally find that easier than including everything in one long file. You can also divide your code into multiple source files so they do not get too long and hard to read.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    41
    Wow just made the header file like you said, makes everything so much more easy. Thanks.
    Shouldent NULL be, 78, 85, 76, 76, or just 0 or, 4E, 55, 4C, 4C

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Is this thread also here?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    May 2002
    Posts
    41
    Yes that was for another post topic and I wanted people to see it here. Because people migh of skipped looking at that topic.
    Shouldent NULL be, 78, 85, 76, 76, or just 0 or, 4E, 55, 4C, 4C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debug into Source
    By lehe in forum C++ Programming
    Replies: 4
    Last Post: 02-18-2009, 10:45 AM
  2. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  3. Open Source Licenses
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 10-10-2006, 08:53 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM