--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00003 Date: 02/12/98 From: BOB STOUT Time: 10:26pm \/To: NEIL HELLER (Read 3 times) Subj: CALLING DOS COMMANDS On , Neil Heller (1:161/204@fidonet) wrote: > Just a simple question: Neil... Fair enough... > What exactly IS fork() The fork() function does pretty much what it says - it creates a new process identical to the one which invoked it. Since it creates a new process, it's obviously not going to appear in any single-tasking OS, such as DOS. Typically the code will look something like this: /* Do stuff here */ switch (fork()) { case -1: /* Handle the error condition */ break; case 0: /* This is now the child process running - handle it */ break; default: /* We've returned to the parent process - continue */ } The key thing to remember is that fork() creates an *exact* duplicate of the process which called it. The only way for the next line of executable code to tell whether it's the parent or child is to test the return value from fork(). Also note that both the child and parent will be running simultaneously in a multitasking environment. Having said that, I should note that there are some exceptions, some obvious, some not so obvious: 1. The child process has a new unique PID. 2. The child process has the PID of the caller as its parent PID. 3. The child has a copy of its parent's file descriptors, referring to the same open files. 4. The child has its own copy of the parent's open directory stream. 5. The timers returned by the times() function (Posix.1 process times) are reset for the child process. 6. File locks are not inherited by the child process. 7. Pending alarms are cleared for the child process. 8. There are no pending signals for the child process. > and why haven't you (or anybody else) mentioned spawn() and the related > family of functions (including spawno by Ralph Whathisname)? The spawn family of calls are unique to PC-based single-tasking operting systems, although they're also present in Win32 and OS/2 systems for backwards code compatibility. Ralf Brown's spawno() and other similar swapping spawn functions exist to overcome some of the inherent shortcomings of a 16-bit single-tasking OS (i.e. DOS). --- QM v1.00 * Origin: MicroFirm : Down to the C in chips (1:106/2000.6) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00004 Date: 02/12/98 From: BOB STOUT Time: 10:50pm \/To: FRANK ADAM (Read 3 times) Subj: C_PlusPlus elections results to date On , Frank Adam (3:635/728.21@fidonet) wrote: >> To be Frank, we should do it. To be anybody else, we shouldn't. :-) RS> Or, to paraphrase Rhett Butler, "Frankly, no one else gives a damn..." > Whoa, a certain majority once voted for Ronald Reagan as well..:-) > FIDO etiquette has obviously been forgotten in this thread. ;-/ Frank... It was just a continuing play on the word, "frank" in its various connotations - nothing else was meant nor should be implied. Sorry if you found it offensive. --- QM v1.00 * Origin: MicroFirm : Down to the C in chips (1:106/2000.6) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00005 Date: 02/15/98 From: TIM HUTZLER Time: 06:37pm \/To: FRANK MASINGILL (Read 3 times) Subj: Re: Boolean logic -=>Quoting Frank Masingill to All <=- FM>Something's obviously wrong with the program below. You FM>programmers can, I'm sure figure what I'm trying to learn. Will you FM>straighten it up for me? Thanks. FM>#include FM>#include FM>int main() FM>{ FM>clrscr(); FM>int IWantTo, IDontWantTo; FM>IWantTo = 0; IDontWantTo = 1; FM>cout << IDontWantTo << endl; FM>if(IWantTo) FM>{ FM>cout << IWantTo << endl; FM>return IWantTo; FM>} FM>else FM>if(IDontWantTo) FM>{ FM>cout << IDontWantTo << endl; FM>return IDontWantTo; FM>} FM>} Missing a bracket "{" after the else and a "}" to close the block, ie. three at the end. FM>Sincerely, FM>Frank --- Maximus/2 3.01 * Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00006 Date: 02/16/98 From: DARRELL HNIZDOR Time: 12:25pm \/To: TIM HUTZLER (Read 3 times) Subj: Re: Modem Guess what? I just ran the sample program from the Borland Newsgroup and it bombed! I also found some "Snippets" and they also bombed, seems they are too old, use obsolete style. So far I have been unable to DO WINDOWS. I am now exploring JAVA for and easier way to buttons. /s --- Platinum Xpress/Win/Wildcat5! v2.0 * Origin: Friendship Corner Albany, TX 915-762-2745 (1:392/25) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00007 Date: 02/16/98 From: DARRELL HNIZDOR Time: 12:29pm \/To: LEONID BUTENKO (Read 3 times) Subj: Modem Thanks, I didn't even know that TAPI existed until a couple hours ago when I saw it mentioned on the Borland Newsgroup. They get a lot of messages from people who are trying to access serial port/modem. By the way for anyone interested check the help file TAPI , the "T" stands for Telephony. Unfortunately seems to be Win95 only. --- Platinum Xpress/Win/Wildcat5! v2.0 * Origin: Friendship Corner Albany, TX 915-762-2745 (1:392/25) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00008 Date: 02/16/98 From: DARRELL HNIZDOR Time: 12:32pm \/To: JONATHAN DE BOYNE POLLARD (Read 3 times) Subj: Modem Thanks, that's very creative. I didn't know it was possible to address the modem that way. --- Platinum Xpress/Win/Wildcat5! v2.0 * Origin: Friendship Corner Albany, TX 915-762-2745 (1:392/25) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00009 Date: 02/15/98 From: STEVEN LEI Time: 06:30pm \/To: FRANK MASINGILL (Read 3 times) Subj: Boolean logic While Steven was reading other messages, Frank Masingill wrote: FM> Something's obviously wrong with the program below. You FM> programmers can, I'm sure figure what I'm trying to learn. Will you FM> straighten it up for me? Thanks. In boolian, 0 = False, all other numbers = True... so the "IDontWantTo" equalled to True (denoted by 1), therefore, it showed that. Steven Lei From: Las Vegas, Nevada, USA E-mail = SpewMuffin@juno.com ... Danger, Frank Masingill! Off-topic messages! Danger! ___ Blue Wave/DOS v2.30 [NR] --- Hyper No Mo Mail! * Origin: CORVETTE BBS - Las Vegas, Nevada (702) 431-2284 (1:209/218) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00010 Date: 02/13/98 From: FRANK MASINGILL Time: 10:23am \/To: ALL (Read 3 times) Subj: Boolean logic Something's obviously wrong with the program below. You programmers can, I'm sure figure what I'm trying to learn. Will you straighten it up for me? Thanks. #include #include int main() { clrscr(); int IWantTo, IDontWantTo; IWantTo = 0; IDontWantTo = 1; cout << IDontWantTo << endl; if(IWantTo) { cout << IWantTo << endl; return IWantTo; } else if(IDontWantTo) { cout << IDontWantTo << endl; return IDontWantTo; } } Sincerely, Frank --- PPoint 2.05 * Origin: Maybe in 5,000 years - frankmas@juno.com (1:396/45.12) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00011 Date: 02/13/98 From: TOM TORFS Time: 01:46pm \/To: FRANK ADAM (Read 3 times) Subj: calling dos commands Frank Adam wrote in a message to Bryan Joyce: >> What's the difference between exec and spawn? They both seem to do the >> same thing. BS> exec() is part of the Posix.1 standard, spawn() is DOS/Win-only. [To Bob] Isn't there a more essential difference ? Namely that exec() overlays the current program and therefore never returns, while spawn() may be used in that way but also so that it returns. At least that's the way it's implemented by Watcom and Borland. FA> Spawn() also returns the child's exit code, exec() only returns the FA> OS's success or failure of executing it. Since exec() never returns on success, it would seem pretty difficult to me for it to return any status whatsoever upon successful execution. greetings, Tom tomtorfs@village.uunet.be --- timEd/2 1.10+ * Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2K00012 Date: 02/12/98 From: ARRON CUSIMANO Time: 05:20am \/To: ALL (Read 3 times) Subj: warnings using class hi all, i get the folloing error messages from DJGPPv2 (GNU C++) Warning: initialization of nonconst 'Vector &' from rvalue 'Vector' Warning: in passing argument 1 of 'Vector::operator =(Vector &)' here's the relevent code snips... if anyone can tell me how to make these warnings go away i would be grateful. class Vector { public: double x, y, z; Vector(); Vector(double x1, double y1, double z1); Vector (Vector &); Vector operator=(Vector &); } Vector Vector::operator=(Vector &b) { x = b.x; y = b.y; z = b.z; return *this; } int main(void) { Vector points[NUM_VECT]; Matrix m; points[0] = Vector( 90, -50, 0); /* warning here */ points[1] = Vector( 0, -90, 0); /* & here */ } ... "I find your lack of faith disturbing." - Vader --- EzyBlueWave/2 V1.49b2 00F90061 * Origin: Gaz's Grotto #2 Adelaide +61-8-8351-8670 33k6 (3:800/2)