Re: [Dev-C++] How do I pass arrays of data from a function?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2002-10-21 23:33:26
|
Well, destructors are the one of the little extras you get from C++. All objects - struct variables with a twist :-) - might specify a special destructor function that should be called the variable is about to die - run out of scoop or being deleted. The input and output streams are such objects, and the desctructor function defined for them will check if the stream is still open, and if so, automatically flush any pending data and close the stream. Any good book about C++ contains a chapter or two about how to create and destroy objects. Cheers /Per W On Mon, 21 Oct 2002, Rob Peacock wrote: > At 12:31 AM 10/22/02 +0200, Per Westermark wrote: > >A number of problems here, but that is what learning is about :-) > > That's why I'm asking :) > > Points 1 thru 5 well taken. I will try to implement those ideas whenever I > can. > > >Number 6. > >There isn't any need to reopen that poor a_file for each line you are > >about to write out. > > I have learned my lesson concerning 'Save often and save frequently' > because of losing edited graphics files due to power failures. > > >And the close shouldn't be needed if a_file is defined within a local > >scoope, since it will be automatically closed when a_file leaves the > >scope, and the destructor is run. > > What is the 'destructor'? The main book that I have been using for > reference has been K&R because I want to learn *relatively* platform > independant code. I don't necessarily like MS but there aren't a whole lot > of people in my target audience that are all that knowledgeable about > Linux, Macintosh, etc. > > >Number 7. > >You have to give the program a chance to terminate the input loop somehow. > >Maybe you should add a check if the user has pressed enter without > >specifying any characters. It might be a bit bothersome if the user has to > >enter 4096 separate commands before the program ends. > > Point taken. At the begining of the program, the user is asked for the > number of shells that will be involved. Typically, it will be anywhere from > 100 to 500 entries. When they sit down to do the data entry, they are in it > for the long haul (they are populating a shell database). > > >I home these comments helps you somewhat on the way. Pointers and arrays > >does have a way of making the life miserable for C or C++ programmers :-) > > I appreciate your help. When I had C in college, I never made it through > pointers. Life interrupted about that time and I had to ignore school for > 1/2 a semester. I passed the class because I had aced all of the > assignments and tests prior, as well as making all of the code run under > DEC Unix, gcc, and MetroWerks/Mac. > > Thanks again, I will probably be asking more questions - like talking to > serial ports on NT ARRGGG! > > --->Rob > > > ------------------------------------------------------- > This sf.net emial is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |