toxifier's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
29 (0.03 per day)
Joined:
27-September 11
Profile Views:
259
Last Active:
User is offline Oct 23 2013 11:47 PM
Currently:
Offline

Previous Fields

Country:
IN
OS Preference:
Who Cares
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   toxifier has not set their status

Posts I've Made

  1. In Topic: Bank File

    Posted 23 Oct 2013

    Quote

    I don't wish to break the program in multiple functions and want to keep this design

    Quote

    Why are you against using more functions?

    Why would you want to keep your design, if it is a bad design?


    I am not "against" it. I too like breaking my program into parts. Actually I am trying to finish the exercises of an old book on C. It uses quite outdated headers and functions of the time of Turbo C. I am just trying to stick to the way it teaches. Not to please anyone, but to see if I can make the programs that way too or not and with only those concepts that they taught in that book until that chapter.


    Quote

    Several things standout to me as very poor design issues. For example look at the following snippet:
                fflush(stdin);
                printf("\nEnter the name of the Customer: ");
                gets(newCustomer.name);
    

    There are at least two horrible design elements in this small snippet.

    One fflush() is not designed to work with input streams.

    Two gets() is a buffer overrun waiting to happen. You need to forget you ever heard about this function. Never use a function to retrieve a C-string that doesn't limit the number of characters it will retrieve.

    You also need to check that your file actually opened properly and the read/write functions succeeded.


    Actually if I don't use fflush, gets is unable to fetch the input. Even scanf fails for char arrays. If I use int array, it works fine. Moreover I wish to get more than one word stream, and I thought using the regular expression to get everything until encountering \n would be a bad idea since the book doesn't say anything about it. As I said, I was trying to stick to the minimal and old concepts it taught.

    Next, about the gets() part, I know I didn't check array bounds, but I was careful in entering names that were <30 char long.

    And won't the ferror would check the correct file opening? How can I check in some other way if possible?
    I now think either I should try these programs on Turbo C only, else I will have to stop sticking to the book-things.

    Thanks for your time though. Much appreciated sir! :)

    View PostSkydiver, on 23 October 2013 - 02:19 PM, said:

    Why are you not checking the return values of remove() and rename(). If you check the return values and followup checking the errno variable, it would give you hints as to why the delete and rename are not working.


    Okay, thanks. But from the code point of view, am I missing something? Or is it fine?
  2. In Topic: Bank File

    Posted 23 Oct 2013

    View Postno2pencil, on 23 October 2013 - 10:22 AM, said:

    ** Renamed title to be more descriptive of question **

    Thanks, I hope I get someone to help me soon :)
  3. In Topic: Books on C++

    Posted 23 Oct 2013

    I don't know if I have seen books on C++ better than the ones written by Robert Lafore and Bjarne Stroustrup
  4. In Topic: Connectivity Issue between Database & Drop Down List

    Posted 13 Jul 2012

    View Postzeeshanef, on 12 July 2012 - 09:43 AM, said:

    you said:
    "select Afghanistan from StateList";  //if i use this instead it works!
    


    If above works then, there is just one difference which is single quotations across Field Name remove these symbols from "dynamic" query and check again:

    string statestr = "select " + Cntrylst.SelectedValue.ToString() + " from StateList";
    

    Honestly, I was trying to solve this in the morning today and got it right(I hadn't read your reply till then). I just came here to tell that I did this and got it right and then saw that I have got the same reply from you already. It works completely fine now and yes your reply is correct. Thanks a lot for your time! Good Day friend! ^_^
  5. In Topic: Connectivity Issue between Database & Drop Down List

    Posted 12 Jul 2012

    View Postzeeshanef, on 11 July 2012 - 10:16 AM, said:

    Did you check the value of [statestr] variable, before it is executed, and do you see the exact query which you expect to run!

    yes! it has the expected value!

My Information

Member Title:
New D.I.C Head
Age:
21 years old
Birthday:
August 9, 1992
Gender:
Location:
India
Programming Languages:
C, C++, JAVA, ASP.NET, C#

Contact Information

E-mail:
Private
Website URL:
Website URL  http://toxifier.blogspot.com/
Twitter:
TheToxifier

Comments

toxifier has no profile comments yet. Why not say hello?