--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00007 Date: 12/27/97 From: KURT KUZBA Time: 01:05pm \/To: BOGDAN SHEPTUNOV (Read 2 times) Subj: how should I return point BS> Code looks like this: BS> char* BS> IniFile::readLine(void) BS> { BS> char buffer[NAME_MAX_LENGTH]; BS> char *_value; BS> BS> while (!_iniFile.eof()) BS> { BS> // read line BS> _iniFile.getline(buffer, NAME_MAX_LENGTH); BS> BS> if (strstr(buffer, "Server port name:") == NULL) continue; BS> BS> _value = strchr(buffer,":"); BS> _value++; BS> return _value; BS> } BS> // nothing found - return 0 BS> return 0; BS> } You are returning a pointer to a string which no longer exists once you exit the function. You must either use a static, a global, allocated, or a class variable. Since this IS a class function, you should probably just put a pointer in your private data, initialize it to NULL in the constructor, and test on each use, calling delete if it already points to something, and redefining it with new to hold the current info. Test it again in your destructor, and call delete if it is not NULL, to clean up any possible memory leaks. Now you are working with something stable and reliable that will be there after you return from the function call. If you know for certain the upper limit of characters you will require, then you might just place an array of type char in your class and use that instead of dynamic allocation. > ] Wait a minute... ///\oo/\\\ Almonds don't have legs......... --- * Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00008 Date: 12/27/97 From: KURT KUZBA Time: 01:05pm \/To: ANTHONY TIBBS (Read 2 times) Subj: Windowing 5/5 /*_|_| begin WINDERS.CPP (part 5 of 5) ** _|_|_| PUBLIC DOMAIN by Kurt Kuzba 12/25/1997 ** _|_|_| A simple example of using windowed text in Borland C++. ** _|_|_| No warrantees or guarantees given or implied. ** _|_|*/ // Test code **************************************************** int main(void) { short cursor = *((short*)0x00400050L); // just getting the cursor position so I can restore it later BasicWindow *Plain = new BasicWindow; Plain->Create(6, 11, 75, 15); // the syntax is compatible with Borland's. easier to remember. Plain->TxtOut( "A plain window with no border or shadow."); Plain->SetColors(0x30); // example of how we can change text colors Plain->TxtOut("Just keep hitting keys until you exit the" " program.", 3, 0); // giving a zero parameter automatically centers our text. getch(); BorderWindow *Border = new BorderWindow; Border->Create(21, 6, 60, 20, 0x2e, 0x30); // we can specify our border and window colors Border->TxtOut("A Bordered Window.", 0, 0); // centering works for vertical as well as for horizontal getch(); DoubleShadowWindow *Shadow = new DoubleShadowWindow; Shadow->Create(1, 2, 45, 11, 0x6a, 0x60); Shadow->TxtOut("A window with a double shadow.", 2, 0); getch(); delete Shadow; getch(); delete Border; getch(); delete Plain; getch(); window(1, 1, WIDE, HIGH); *((short*)0x00400050L) = cursor; cprintf("\r"); // restore startup cursor position and move to column one return 0; } /*_|_| end WINDERS.CPP (part 5 of 5) */ > ] You cannot enter the Underground without a Tolkien.......... --- * Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00009 Date: 12/25/97 From: CAMERON CLARK Time: 11:29pm \/To: ADAM MAJER (Read 2 times) Subj: Re: Rotating Bitmaps AM> I've developed a utility to rotate bitmaps but it's very, very slow. I'm AM> using sine and cosine and stuff, but I'm looking for a faster and better AM> ways of rotating stuff. Could anyone post some code that rotates AM> bitmaps? AM> AM> PS My procedure gives me 7 frames per second on 486 using 32x32 bitmaps. Do you use lookup tables for sin/cosine, or do you calculate it every time? --- GEcho 1.00 * Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00010 Date: 12/25/97 From: CAMERON CLARK Time: 11:31pm \/To: LEE KIRBY (Read 2 times) Subj: Re: Extra bytes LK> I'm very new to C++, and can't figure out why I get two extra bytes when LK> write this structure to a file: Are you using a binary file? Otherwise, ascii char 10 may be changed to 10 13 for text crlfs. --- GEcho 1.00 * Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00011 Date: 12/27/97 From: LESLIE SATENSTEIN Time: 01:59pm \/To: BOB STOUT (Read 2 times) Subj: I need c++ In a previous message concerning " I need c++ ", Bob Stout said..... BS> On , Hans Bakker (2:282/210@fidonet) wrote: BS> BS> JJ> Jake - I'm not sure about Canadian law, but anyone in the States who BS> JJ> would upload a copy of a C++ compiler for you would be infringing on BS> JJ> somebody's copyright (Could be Symantec, Watcom, MicroSoft, Borland, BS> JJ> or whom ever's compiler they uploaded) and subjecting themselves to BS> BS> > hmm . . I don't think that people who use it for their hobby are using BS> > a legal copy. Only people who use it for their job are using legal copy's BS> BS> Hans... BS> BS> If you're correct, then I must assume that most hobbyists BS> in Europe are thieves. Thanks for the warning - if I were BS> to believe you, I'd be sure never to try to market BS> anything there. Fortunately, I know enough people (both BS> pros and hobbyists) over there who are not software BS> thieves, so I know you don't speak for everyone. Your BS> statement is an insult and an affront to all the hobbyists BS> in zone 2 who don't share your disregard for the law. BS> BS> BS> --- QM v1.00 BS> * Origin: MicroFirm : Down to the C in chips (1:106/2000.6) BS> Hi Bob, Season's greetings. I don't condone piracy, but sometimes I wonder if I am right. I no longer program entirely in C, or CPP, and therefore my compilers are not used as they should be. Often times I have need to evaluate some software that is not offered as evaluation copies. What to do? My computer club doesn't have the resources to buy the package, even though they many times get a discount on purchases so that a copy could be bought and given as a door prize, etc.... So.. I read the glossy's and wonder about many products. I often think of doing a shared purchase, as a sale to two individuals is better than none. This I have not done yet. The best approach to software evaluation that I have experienced, and I applaud them for it, is from IBM. One can download and install the product, and it will run for 60 days. After which, it is disabled. No amount of additional reinstalling will get it to work, except for a operating system resinstall (clever of them). In this way I purchased their VISUAL CPP product after I learned all it's capabilities. Other vendors could follow their example. Perhaps it would mean many more sales and much fewer pirated copies? Leslie Satenstein 97/12/25 ___ X KWQ/2 1.2i X Look Ma, I'm a *Beta Tester*: KWQ Mail/2 for OS/2 v2.X! --- Maximus/2 3.01 * Origin: Juxtaposition BBS. Lasalle, Quebec, Canada (1:167/133) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00012 Date: 12/24/97 From: JAN BIJSTERBOSCH Time: 06:40pm \/To: BOB STOUT (Read 2 times) Subj: SNIPPETS news Hello Bob, 22 Dec 97, Bob Stout of 1:106/2000.6 wrote to >> All << BS> In this mail bundle, I am uploading SNIPVWIN.ZIP to my BS> bossnode. [ some snipped ] BS> As you might guess from the title, this is a BS> Windows-hosted viewer for SNIPPETS files. As with the text BS> version, this was donated by Tom Torfs. I've tested it under BS> Win95, release B (yes, I finally got a new machine) and it BS> works great. Is Win95 OSR2 a 'must', or is OSR1 with service pack1 enough to use it? Yes, I had to migrate to new machine a few years earlier. BS> Many thanks to Tom for his efforts! Hearyea, hearyea... Greetings from rainy Amsterdam and best wishes for 1998, Jan email:bijster@worldonline.nl http://www.worldonline.nl/~bijster --- MBM v3.41e * Origin: Snuffelaar bij DosBoss West (2:500/121.5122) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00013 Date: 12/26/97 From: HANS BAKKER Time: 01:38pm \/To: BOB STOUT (Read 2 times) Subj: I need c++ Hello Bob! Thursday, December 25 1997 13:11, Bob Stout wrote to Hans Bakker: BS> Hans... BS> If you're correct, then I must assume that most hobbyists in Europe BS> are thieves. Thanks for the warning - if I were to believe you, I'd be BS> sure never to try to market anything there. Fortunately, I know enough BS> people (both pros and hobbyists) over there who are not software BS> thieves, so I know you don't speak for everyone. Your statement is an BS> insult and an affront to all the hobbyists in zone 2 who don't share BS> your disregard for the law. Well, let's take a look at all the programs that i use. C++ Fl 300,-- Win (2x) Fl 300,-- Novell Netware Fl 1000,-- BBS software Fl 500,-- Office Fl 700,-- That's almost 3000 Gulden. And you think that there are much people that register all the programs they use?? I just don't have so much money.. And when i had it, I would spend it buying a new Computer. . (and don't forget al those games) Mzzl!! Hans -=[ HeXaCoM BBS +31-591-387000 P.O. Box 1154 7801 BD Emmen ]=- ... Error 005: Windows loading. Come back tomorrow. --- * Origin: HeXaCoM BBS -=<[ aCCeSS To THe FuTuRe ]>=- (FidoNet 2:282/210) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00014 Date: 12/26/97 From: TIM HUTZLER Time: 12:21pm \/To: RICHARD BRICE (Read 2 times) Subj: Re: Attachement File? RB>Well the last one I received was a photo of a dog(they told me) on RB>JPEG. RB>Here is what I tried to do: RB>1. since it came in on PRODIGY I went to the FILE part of Windows RB>3.11 and found PRODIGY and the sub-files. I found the name of it RB>and then went to WordPerfect 6.1. RB>2. I tried to retreive it on W/P by going to C:\(and the name of the RB>file I found on the sub-file.) RB>3. I then went to PAINT BRUSH and tried to bring it up. No Luck. RB>Do you know what I should have done? I presume you want to *view* this file? Since this is a C++ echo, I might suggest that you obtain a JPEG library and compile a JPEG decoder/viewer. But, I think you don't want to go through such trouble - I wouldn't. [grin] There are pleanty of viewers on the shareware market, and some photo editors as well. Do you have Internet access? ___ Blue Wave/QWK v2.12 --- Maximus/2 3.01 * Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00015 Date: 12/26/97 From: TIM HUTZLER Time: 12:26pm \/To: CARLO MOSTI (Read 2 times) Subj: Re: asm CALL doesn't wor CM>Salut/Hi Tim Hutzler! TH>I do a lot of inline assembly programming, but I haven't found a way TH>to use the CALL with my Borlands 3.0 compiler. The error message TH>is "undefined symbol" But the symbol is there. CM>Well, correct me if I'm wrong, but it seems you're calling a CM>label instead of a procedure the way it's written. Sure. In assembly that's the way it would be done. CM>If MyLabel was meant to be a procedure,... In assembly parlace, it would be called a "subroutine"... CM>what I suppose is the case since you're calling MyLabel instead of CM>jumping to it, then write it as a normal C procedure containing CM>the assembly lines like this: [...] Oh, don't make it too easy, Carlo. [grin] CM>Hope it helps! I'll mess around with that idea. Thanks. CM>See ya! Best regards... ___ Blue Wave/QWK v2.12 --- Maximus/2 3.01 * Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGX00016 Date: 12/28/97 From: BOB STOUT Time: 06:46am \/To: JAN BIJSTERBOSCH (Read 2 times) Subj: SNIPPETS news On , Jan Bijsterbosch (2:500/121.5122@fidonet) wrote: RS> In this mail bundle, I am uploading SNIPVWIN.ZIP to my bossnode... As ou RS> might guess from the title, this is a Windows-hosted viewer for SNIPPETS RS> files. As with the text version, this was donated by Tom Torfs. I've RS> tested it under Win95, release B (yes, I finally got a new machine) and RS> it works great. > Is Win95 OSR2 a 'must', or is OSR1 with service pack1 enough to use it? > Yes, I had to migrate to new machine a few years earlier. Jan... TTBOMK, it should run on any version from Win 3.1 up. I should have pointed out that the only reason I mentioned OSR2 is that it's the only version of Windows I had running on the new machine at the time that I posted the message. I've since learned that I'm going to have to re-install Win 3.1, either in my DOS partition or under OS/2. --- QM v1.00 * Origin: MicroFirm : Down to the C in chips (1:106/2000.6)