Thread: Useful program

  1. #1
    Deleting... VOX's Avatar
    Join Date
    Oct 2004
    Location
    VA
    Posts
    94

    Useful program

    Here is a little program I made that displays ascii key codes. It can display the full listing, a designated number of codes, or a single code. Great for when you need to know a code for something real fast. If you think I should make any changes to it tell me.
    Boy you stink, go take a shower before you continue to code. Better do your laundry and spray your chair too.

    The one and only resource for finding information.

    Next version of windows released!!!!

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Post source code.

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    My mommy told me never to accept executables from strangers.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    I have neither the time nor the inclination to disassemble your program and make sure that it's safe. The program doesn't sound that enticing either, so you'll need to post some code to attract my interest.
    My best code is written with the delete key.

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    Here is a little program I made that displays ascii key codes.
    Just what I always wanted! I was wondering when someone was going to write something as useful as this!

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well you know Christmas is coming around soon and all.

  7. #7
    Deleting... VOX's Avatar
    Join Date
    Oct 2004
    Location
    VA
    Posts
    94
    Why would I give you all something that would harm your PC? Here is the source code but it's nothing special.
    Boy you stink, go take a shower before you continue to code. Better do your laundry and spray your chair too.

    The one and only resource for finding information.

    Next version of windows released!!!!

  8. #8
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    We distrust everyone. Plus no one learns from the executable

    Edit: Speaking of learning:
    Things I see wrong without even thinking
    Code:
    #include <conio.h>
    Non standard header
    Code:
    void main()
    Main returns an int
    Code:
    printf("%c %i\n",c,c);
    1) Not every machine uses ASCII so this won't print the ASCII table correctly on all machines
    2) c is an int, you are passing an int when you should be passing a char for the first type specifier
    Code:
    gets(code);
    THERE IS NO EXCUSE FOR gets() EVER!


    See this is why we ask for the source. Had my computer ran this it would have kicked me.
    Last edited by Thantos; 12-19-2004 at 07:26 PM.

  9. #9
    Deleting... VOX's Avatar
    Join Date
    Oct 2004
    Location
    VA
    Posts
    94
    Did I ask for your comments on my code? No. Did I say it was flawless 150% correct code? No! You don't need include files for the program to work, so it doesn't matter what header you use. If it does't work right for you then you can't use it. Unless you are on purpose going to overflow gets with jargon then it doesn't matter to me what input function you use. I made it for convenience so if you don't like it, don't use it. Very simple. Go look your codes up in a book if you hate it so much.

    I use it all the time and it does it's job well. In my opinion it is very immature for someone to immediately pick at every little thing in someone's code. Go make your own ascii viewer.
    Last edited by VOX; 12-19-2004 at 07:36 PM.
    Boy you stink, go take a shower before you continue to code. Better do your laundry and spray your chair too.

    The one and only resource for finding information.

    Next version of windows released!!!!

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    My ascii viewer: www.asciitable.com

    If you stop being so offended VOX, you can learn quite a bit from the suggestions that Thantos gave. It's not "picking" on you, it's education. It goes a bit beyond putting something together quickly for convenience. Unexpected behaviour has never been too "convenient" for me. There are some issues with the code that, if improved upon, will provide a much more stable and share-worthy program.

  11. #11
    Deleting... VOX's Avatar
    Join Date
    Oct 2004
    Location
    VA
    Posts
    94
    Maybe you are right, but I don't see anything wrong with void main and including the conio.h header. I'll try to change the gets.
    Boy you stink, go take a shower before you continue to code. Better do your laundry and spray your chair too.

    The one and only resource for finding information.

    Next version of windows released!!!!

  12. #12
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    The FAQ and this site can explain "void main" better than I can.

  13. #13
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    And as for conio.h, the only problem is that it's non-standard. If you're distributing a commercial application, that's not a problem. If you're in a situation where you'd be required to provide source code, such as a forum or open-source project, expect to get flak, as people aren't guaranteed to be able to compile it.

    Don't get offended by such criticism. What Thantos wrote was clearly written with the intention of helping you become a better programmer.

  14. #14
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I'm sorry if you felt I was attacking ya VOX. I know the big red letters can seem harsh but when I see gets() I lose control

    Only thing I don't like about conio.h is that its a non-standard header that a lot of beginners use as a crutch.

    The main thing to get from the printf() I pointed out was the error in the parameter passing

  15. #15
    Deleting... VOX's Avatar
    Join Date
    Oct 2004
    Location
    VA
    Posts
    94
    Thanks, sorry I snapped back so fast, but I don't really know anything that can read more than one key or a string from the keyboard other than gets or scanf. Heck, if I didn't use gets I don't think I would need conio.h to begin with I read a post somewhere about using fgets instead. I'll try that for all my string-reading needs.

    Also, do you know if there is a function in Turbo C anywhere that will set the default DOS cursor to off? It is getting quite annoying in my RPG and is even slowing things down.
    Last edited by VOX; 12-19-2004 at 09:06 PM.
    Boy you stink, go take a shower before you continue to code. Better do your laundry and spray your chair too.

    The one and only resource for finding information.

    Next version of windows released!!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM