--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00017 Date: 07/05/97 From: PAUL WANKADIA Time: 03:32pm \/To: RAFA VELILLA (Read 3 times) Subj: Reset On 29 Jun 97, Rafa Velilla wrote to All -- RV> Does anybody know how to produce a reset by software? The only way I RV> know is: cout<<"Please press the reset button"; RV> ... but it is not satisfactory (sometimes works but sometimes the user RV> don't want to press the button). You'll need to use ASM to do that. How does your compiler do inline ASM? --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00018 Date: 07/05/97 From: PAUL WANKADIA Time: 03:33pm \/To: DANNY GARDINER (Read 3 times) Subj: Basic & C++. On 02 Jul 97, Danny Gardiner wrote to All -- DG> Hi guys I am wondering how much more "powerfull" C++ is over Basic? I C++ is to BASIC what a machinist's workshop is to a rubber hammer. --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00019 Date: 07/05/97 From: PAUL WANKADIA Time: 03:34pm \/To: PATRICK SUNG (Read 3 times) Subj: DJGPP Questions??? On 03 Jul 97, Patrick Sung wrote to All -- PS> In the standard C++, I use the 'new' operator to allocate dynamic PS> memory, however, in DJGPP, I have read the INFO docs on new and it PS> says the new operator used the 'malloc' function to allocate memory. PS> Is it the true and which one is better in DJGPP(new or malloc)? In C, use malloc(). In C++, use new. --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00020 Date: 06/29/97 From: NEIL HELLER Time: 10:14am \/To: JAVIER KOHEN (Read 3 times) Subj: CLASSES JK> #include "mouse.h" JK> JK> const int MOUSEINT = 0x33; JK> JK> MouseInfo::MouseInfo() JK> { JK> setButtons(-1); JK> } It seems to me that you don't want to call an external function in the constructor. * KWQ/2 1.2i * --- TMail v1.31.5 * Origin: Diablo Valley PCUG-BBS, Walnut Creek, CA 510/943-6238 (1:161/55) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00021 Date: 06/29/97 From: NEIL HELLER Time: 10:18am \/To: CHRISTOPHER BUTLER (Read 3 times) Subj: GRAPHICS ROUTINES CB> delete &gs; // Back to text mode JK> No!!! You never allocated gs with new, so you mustn't delete it! And therein lies the seed for your GPF. * KWQ/2 1.2i * --- TMail v1.31.5 * Origin: Diablo Valley PCUG-BBS, Walnut Creek, CA 510/943-6238 (1:161/55) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00022 Date: 06/29/97 From: STEWART EVANS Time: 03:46pm \/To: ALL (Read 3 times) Subj: c++ help G'day everyone, I've just started C++ at uni this year and was wondering if anyone could point me in the right direction to creating a good user interface, all I know concerning this stuff is basic cout or printf stuff, other than that I dont really have a clue. any help would be apreciated thanks stewart --- Ezycom V1.48g0 03fa00ce * Origin: THE PANTHEON NSWAustralia +6143423594 (3:711/472) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00023 Date: 07/05/97 From: CHRISTIAN KOTZ Time: 12:24pm \/To: PATRICK SUNG (Read 3 times) Subj: DJGPP Questions??? Hello Patrick! reply to a message from Patrick Sung to All: PS> In the standard C++, I use the 'new' operator to allocate dynamic PS> memory, however, in DJGPP, I have read the INFO docs on new and it PS> says the new operator used the 'malloc' function to allocate PS> memory. Is it the true and which one is better in DJGPP(new or PS> malloc)? You should always use new in C++. (Default) ::new is usually (internally) implemented as a call to C-Library malloc, but thats need not bother You. bye, Christian! --- * Origin: for(;;)full()?sleep():eat(); (2:310/78.19) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00024 Date: 07/06/97 From: PAUL WANKADIA Time: 12:56pm \/To: JUHAN-A NAKKALAJARVI (Read 3 times) Subj: Programming Questionnaire * prize for 312:56:4007/06/97 On 03 Jul 97, Juhan-A Nakkalajarvi wrote to All -- JN> What language/langueages you use? (program) JN> Which langueages you used long time ago? I started with BASIC, then moved to C, C++ and ASM. JN> Which compiler do you use? JN> Which platform you use? DJGPP, which makes my DOS executables. JN> Which kind of code style you use? JN> d. JN> void main() { JN> Code(); JN> } That one, even though the people working on the Linux kernel advocate another style... JN> How many space you use as tab size? (I mean:) void main() I used to use five, but the TABs kept getting mangled, so I just use eight. JN> What kind of program you make? Demos? Games? Useful programs? JN> Some crap that no-one will ever see? I'm trying to write an OS now, so it is probably the last option... JN> Are your programs well designed and easily expandable, with clean code, JN> or or do you make your programs a bunch of strange write-only crap? I'm thinking of writing a complex macro language that will allow you to write your C and C++ programs in semi-English, using the preprocessor to expand everything back to normal, but I doubt I'll ever get 'round to it. JN> Do you use in your code ever inline- or anything else Assembly? The code I'm working on right now is ASM, since it's the initial setup for my kernel. Once that is done, everything else should be in C and (maybe) C++. JN> How old are you? Fifteen now. JN> In what age you started programming? What language you used? I remember first programming in BASIC on my olde C-64 ... I must have been between five and ten years old at the time ... --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBC00025 Date: 07/06/97 From: KEN WAUGH Time: 06:45pm \/To: CHRISTOPHER BUTLER (Read 3 times) Subj: Re: Help me! CB> I've got a program here, and it compiled fine a while ago, then I left CB> it for a bit... I've come back to it, and it crashes when it tries to CB> do a getch()! CB> A bit of code that it crashes on: CB> char i; CB> if (inp(0x64) & 1) // same as kbhit() CB> i = getch(); CB> else CB> i = 0; CB> If I press a key then, the DOS box (or whole computer in DOS mode) just CB> crashes... I assume by DOS box, you are referencing a window.. Being new to programming C, and I'm doing this on an Amiga, a lot of things are NEW/buggy to me. The amiga (windows/GUI interface) also has a getch() bug. It isn't so much a bug, as the amiga was never really designed for raw keyboard I/O... Anyways, maybe the note on what Amiga says about their window and getch how it works can help... getch-Get a character from stdin immediately Synopsis #include c = getch(void); int c; /* return character or code */ Description This function gets a single unbuffered character from stdin. If the input is a console device, it will be put into RAW mode until a character is typed, then switched back to the normal buffered mode. This function is not available if the _STRICT_ANSI flag has been defined. Portability SAS/C Returns If successful, the next input character is returned. Otherwise, the function returns EOF, which is defined in the file stdio.h. In the event of an EOF return, error information can be found in the external integers errno and _OSERR . Most programmers treat any EOF return as an indication of end-of-file. However, if you want to distinguish errors from an end-of-file condition, you should reset the external integer errno before calling the function and then analyze its contents when you receive an EOF return. NOTE: This function provides the functionality found in the getchar function in most other compilers on most other platforms. A carriage return is not required before the getch function returns a character. See Also errno , fgetc , fgetchar , fopen , getchar , _OSERR getchar does not work as expected. _______________________________________________________________________ Input and output on the Amiga system are buffered. On most other systems, getchar immediately gets a character from stdin (usually the keyboard). However, the CON: device on the Amiga system buffers its input, so your program does not actually read any characters until you do one of the following: - fill up the console input buffer - press Return - enter the Amiga End-of-File character, Ctrl-\. The SAS/C Development System libraries include two functions that you can use to deal with this problem: getch gets a character from the console in RAW mode. The character is returned as soon as the user types it. rawcon turns RAW mode on and off. rawcon(1) sets the console into RAW mode. rawcon(0) restores the console to non- RAW mode. When the console is in RAW mode, any characters typed by the user are passed immediately to the application. getch returns a single character from stdin just like getchar, but getch gets the character in RAW mode. If your console is not in RAW mode, using getch is equivalent to the following sequence: rawcon(1); c = getchar(); rawcon(0); If your console is in RAW mode, getch is equivalent to getchar . ****** rawcon-Set or unset raw console input Synopsis #include error = rawcon(flag); int error; /* 0 on success */ int flag; /* non-zero for raw, 0 for non-raw */ Description This routine turns on and off the capability of stdin that allows you to get single character input without waiting for a new line character. This routine works with the getch and getchar functions. Normally, the Amiga console device waits until you press the Return key before it passes the keystrokes you enter to your program. Therefore, the getchar function, for example, will not be able to read a single character at a time. Calling rawcon(1) forces the console device to pass each character separately. Calling the rawcon(0) function restores the console to normal operations. This function is not available if the _STRICT_ANSI" Link _STRICT_ANSI} flag has been defined. Portability AmigaDOS Returns A nonzero return value indicates failure. Example /* * * Wait for user to press any key (if possible) * */ #include #include void main(void) { if (!rawcon(1)) { printf("Press any key to continue\n"); /* make sure output from printf is seen */ fflush(stdout); getchar(); rawcon(0); } else { /* unable to switch the console, wait some other way */ printf("Sorry, rawcon() didn't work!\n"); exit(EXIT_FAILURE); } } See Also getch , getchar From what I've found, if I want getch() to work and work everytime I must setup the console both before and after a call to getch. What I finally did can be shown in this example program... int main(int argc, char *argv[]) { int x; char c; if (argc <2) { printf("Here is the ASK programs format \n"); printf("ASK [text]\n"); printf("\"Text\" is displayed then the PC\n"); printf("waits for Y or N to be pressed. Y\n"); printf("returns an ERRORLEVEL of 1; N is 2.\n"); exit(0); } /* print all the arguments */ for(x=1; x TOPIC: 203 C++ Ref: EBC00026 Date: 07/07/97 From: MIGUEL ANGEL SCAPOLLA Time: 06:10am \/To: RAFA VELILLA (Read 3 times) Subj: RE: Reset RV> Does anybody know how to produce a reset by software? The only way I now RV>is: RV>cout<<"Please press the reset button"; RV>... but it is not satisfactory (sometimes works but sometimes the user don't RV>want to press the button). Rafa: Try jump to: F000:FFF0 to hardware reset. F000:E05B to warm boot. and code: cout << "Press any key to reset..."; getch (); asm { jmp F000:FFF0; } This code is for MS-DOS only. Un saludo. Miguel ======================================================== Miguel Scapolla miguelo@blader.com (email) Coronado City miguelo@canopus.com.ar (email) Argentina 4:901/148.30 (fido) ======================================================== --- MjrFIDO 3.25 --- Squish/386 v1.11 * Origin: ISP CANOPUS (BBS) * Bs.As.- ARGENTINA * +54 1 554-2222 (4:90/90)