--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100021 Date: 08/31/97 From: DARIN MCBRIDE Time: 09:50am \/To: ROGER SEN MONTERO (Read 2 times) Subj: volatile objects? -=> Quoting Roger Sen Montero to Darin Mcbride TM>> How do you make it volatile, and how does the compiler complain? DM> On the marked line (!!!), the compiler complains that it cannot find DM> a function "queue >::push(char) volatile". The function, DM> without volatile, exists, though. RSM> STL (specially HP's one) has a lot of problems with multi-threading. RSM> SGI's STL is much better, but it was not designed with multi-threaded RSM> concepts in mind. True - which is kinda why I was hoping to make it volatile and force my own semaphoring around it. In fact, the SafeQueue I posted originally "HAD-A" dequeue as a member variable, and merely enacted Queue<>'s adaptation, with semaphores surrounding every call. That didn't work, and thus the problem... :-) RSM> Recently there was some posts in comp.c++.std about multi-threaded RSM> STL (and some companion files, including bstring.h) Hopefully that'll make it into the platforms that have threads... RSM> I have to do some tests with multi-threading issues and STL (probably RSM> using OS/2) so I'll post a message as soon as I finish them. That would be appreciated. RSM> Moreover, you cannot push chars in a queue >. You should RSM> push deques of chars. As I've recently said, my STL is as outdated as my C++ compiler... and it uses that format because it doesn't support default template parameters. RSM> ... Without the letter U, units would be nits. Sounds like a little nit-picking... ;-) ... Back up my hard disk? I can't find the reverse switch! --- FastEcho 1.46 * Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100022 Date: 08/30/97 From: BOBBY MCNULTY Time: 12:37pm \/To: ALL (Read 2 times) Subj: Gnu C/C++ compiler I recently (about two monthes ago) downloaded Gnu C for windows. Great program. I was wondering how to get it to work in windows. How do I use the GNU C functions in Windows 95? I can work as far as it being in the DOS shell from windows but I wanted to create a program for windows, Bobby --- * Origin: The Com Port BBS (205) 360-9904 (1:375/400) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100023 Date: 08/30/97 From: DANNY SPRINGER Time: 10:37pm \/To: JUAN ALCOLEA (Read 2 times) Subj: Overloading NEW & DELETE: Help! :_( Hi Juan, In a message of to All (), you wrote: JA> Hi, oh gurus! ;) JA> I am working in a big project written in C++, and I want to arefully JA> control the dynamically allocated/deallocated memory, since I am using a JA> lot of dynamic structures, and I suspect I have a memory leak somewhere. JA> What I want is to keep track of the quantity of allocated mem, and the JA> quantity of deallocated one, so I can inspect these values while running JA> my program. What I do with these kind of problems is checking the heap on lots of places: #define _HEAPCHECK_ON <=== include this to switch it on #ifdef _HEAPCHECK_ON #include #include #endif // Repeat these lines everywhere you want to check #ifdef _HEAPCHECK_ON assert(heapcheck() != _HEAPCORRUPT); #endif I start in main, and when I find out in which function the problem appears, I repeat these steps in that function. Still it can be hard to find out exactly where (and why!!!) it happens. Regards, Danny Springer. (dsp@bitbike.com) --- * Origin: Punt 12 uit Den Haag [NL] Point of AINEX (2:282/123.12@fidonet) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100024 Date: 08/27/97 From: FRANOIS DE MEY Time: 02:02am \/To: CAMERON CLARK (Read 2 times) Subj: stream bug??? Hi coder, CC> The following pseudo-code has an unfortunate side effect: CC> (using Borland c++ 4.51) CC> ofstream outf("out.bin"); CC> char string[6]; CC> strcpy(string,"12345"); CC> string[strlen(string)] = '\n'; CC> outf.write(string, strlen(string)); CC> outf.close(); CC> The side effect is that it writes the following: CC> 12345#13#10 (where #13 & #10 are ascii characters) CC> What the hell am I doing wrong? "12345" won't mean that U will have |1|2|3|4|5| in memory, but that U will have |1|2|3|4|5|#0| ( when #0 means end of string ) Then, if U make only a printf with string after put a |#13|#10|, he will write : 12345 dfhdfh#^!{djghj(^^^!{^#@@!('$ ... and so on ... until he found a #0 --Hoping it would be useful 2 U-- Ciao FeP ... Coding is so funny... --- Blue Wave/DOS v2.30 * Origin: Programmer's Paradise -Belgium- 32-10-813088 (2:293/2009) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100025 Date: 08/31/97 From: DWIGHT KAISER Time: 08:20pm \/To: UUCP (Read 2 times) Subj: chat TO: goffy1411@juno.com Hi Karen how are you doing? We are fine here. E-mailed Dad guees he had to work today. will chat later. bye dwight and sherry --- Maximus/2 3.01 * Origin: Wylie Connection 128K ISDN / V34+ 972-429-7005 (1:124/7028) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100026 Date: 08/31/97 From: DWIGHT KAISER Time: 09:22pm \/To: UUCP (Read 2 times) Subj: default TO:katlees@nrctv.com hello kathy this is lil dwight how have you been me im doing ok. i am married with three children we live in wylie texas its a small town i work for the sanitation plant here in the city of plano tx. i change tires and do mechanic work on the dump trucks. i really dont know what to say its been so long since i have seen you or talked to you hopefully we will be able to attend the kaiser reunion well thats all for now got to go hope to here from you soon. lil dwight --- Maximus/2 3.01 * Origin: Wylie Connection 128K ISDN / V34+ 972-429-7005 (1:124/7028) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100027 Date: 08/31/97 From: ALBERTO MONTEIRO Time: 04:15pm \/To: JAMES NORMAN (Read 2 times) Subj: Roman Numeral??? (hpp) JN>Hi there :) was wondering if anybody have any ideas or C++ libraries, that JN>deal with roman numerals?? JN>eg. put_roman(int num); which will display the roman numeral JN> depending on which integer (1-3999) JN> get_roman(); which will read a roman numeral JN> string, and return its integer value!! JN>get_roman() MUST return 1 if invalid string code!! eg. IIV or IC, etc, etc JN>any help would be greatly appreciated!!! thanx I've tried to write it, in two blocks: roman.hpp and roman.cpp. I've tested them, they look fine, but I'm not sure if I've done it right... // begin of file roman.hpp // // Class Roman // Purpose: work with Roman Numerals // Programmed by Alberto Monteiro // Copyright stuff: done by me, used by anyone, credits required, etc // // #include // // The class Roman will store an integer value // (Roman numerals can only represent positive integers...) // and its string equivalent. So: // class Roman { public: char *str; int n; // // It's necessary to have two constructors: one that // takes an integer and converts to roman, and an // other that gets a string a decodes to roman: // Roman(void); Roman(int n0); Roman(char *str0); ~Roman(void); // The only operators I think I must create are the operator // to read and to write: // friend ostream& operator<<(ostream&, Roman&); friend istream& operator>>(istream&, Roman&); }; // end of file roman.hpp // Roman.cpp follows in next message --- SLMR 2.1a AEquam memento rebus in arduis servare mentem --- FMail/386 1.02 * Origin: CentroIn! +55-21-205-0281, 41 lines, 24h, RJ/Brazil (4:802/21) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED100028 Date: 08/31/97 From: ALBERTO MONTEIRO Time: 04:15pm \/To: JAMES NORMAN (Read 2 times) Subj: Roman Numeral??? (cpp) // // begin of file roman.cpp // #include #include #include #include #include "roman.hpp" static char *table1[] = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" }; static char *table10[] = { "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC" }; static char *table100[] = { "", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM" }; Roman::Roman(void) { n = 0; str = NULL; } // // Roman Constructor from an integer // Roman::Roman(int n0) { char str0[50]; int n1; n = n0; if (n <= 0 || n >= 5000) { str = NULL; } else { n1 = n0; *str0 = 0; while (n1 >= 1000) { strcat(str0, "M"); n1 -= 1000; } strcat(str0, table100[n1 / 100]); n1 %= 100; strcat(str0, table10[n1 / 10]); n1 %= 10; strcat(str0, table1[n1]); str = strdup(str0); // problem: keeps killing memory... } } // // Roman Constructor from a string // Roman::Roman(char *str0) { int n1; int k; char *s; str = strdup(str0); // kills memory :-( s = str0; n1 = 0; while (*s == 'M') { // get all M's n1 += 1000; s++; } for (k = 9; k >= 1; k--) { if (!strnicmp(s, table100[k], strlen(table100[k]))) { n1 += k * 100; s += strlen(table100[k]); break; } } for (k = 9; k >= 1; k--) { if (!strnicmp(s, table10[k], strlen(table10[k]))) { n1 += k * 10; s += strlen(table10[k]); break; } } for (k = 9; k >= 1; k--) { if (!strnicmp(s, table1[k], strlen(table1[k]))) { n1 += k * 1; s += strlen(table1[k]); break; } } n = n1; } // // Roman Destructor. As I used "strdup", now I must use free // Roman::~Roman(void) { free(str); } // // Roman output // ostream& operator<<(ostream& Out, Roman& R) { Out << R.str; return Out; } // // Roman input // istream& operator>>(istream& Inpu, Roman& R) { char str0[50]; Inpu >> str0; R = Roman(str0); return Inpu; } int main(void) { // Test case // Roman R0(666), R1("MCMXCVII"), R2; char str[1000]; cout << "666 = " << R0 << " = " << R0.n << '\n'; cout << "1997 = " << R1 << " = " << R1.n << '\n'; for (;;) { cout << "Enter any roman number (1 to terminate): "; cin >> R2; cout << R2 << " = " << R2.n << '\n'; if (R2.n == 1) break; } return EXIT_SUCCESS; } // // end of roman.cpp // --- SLMR 2.1a Amicus certus in re incerta cernitur (Cicero) --- FMail/386 1.02 * Origin: CentroIn! +55-21-205-0281, 41 lines, 24h, RJ/Brazil (4:802/21) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED200000 Date: 09/01/97 From: CAMERON CLARK Time: 02:02am \/To: JAMES NORMAN (Read 2 times) Subj: Re: Roman Numeral??? JN> Hi there :) was wondering if anybody have any ideas or C++ libraries, hat JN> deal with roman numerals?? Sounds like a homework assignment (that I had in the nineth grade). For int -> roman largest_count = sum % "largest roman numeral"; sum = sum % "lrn"; second_largest = sum % "second largest numeral"; sum = sum % "sln"; ... smallest = sum % "smallest numeral"; sum = sum % "sn"; so if the largest to smallest stream of roman numerals looked like "1000,500,100,10,5,1" M = sum % 1000; sum = sum % 1000; C = sum % 500; sum = sum % 500; L = sum % 100; sum = sum % 100; X = sum % 10; sum = sum % 10; V = sum % 5; sum = sum % 5; I = sum % 1; sum = sum % 1; (These are not the correct roman numerals!) The only trick is displaying numbers 4,6,7,8,9 (iv, vi, vii, viii, viii) After getting the mod of 10, you should just use the following char*last[]={"","I","II","III","IV","V","VI","VII","VIII","VIIII"}; to print the last sequence. --- GEcho 1.00 * Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: ED200001 Date: 08/29/97 From: NUNO FILIPE Time: 11:33am \/To: ALL (Read 2 times) Subj: Help me! :) I need to make a program in c++, that allow the user of the program to make and text (that will be automatically recorded to a file (text.txt) in ASCII caracters. The user, should also have the ability of add the name and some other data to a struct that is something like a persons database. Then, the program should add the name of the person to the begin of the text (text.txt), and the file should be printed to everyone in the structure/database with the persons name in the beginning! Can you please help me doing this? To create a struct is: struct structure { char name[40]; char address[40]; char phone[10]; } data[100]; But can you please help me: how can I make a "editor" in the program for the user do the text, but with limits (ex: 20 lines and 30 colunes), and copy it to a ASCII file? I really need this, as son as possible! So, if someone here knows how to do this, I would be very gratefully! ;-) Be happy and live long! --- FMail/Win32 1.22 * Origin: Files 'R' Us BBS * Esmoriz * 056-754530 * 22h/8h * 33.600 (2:361/46)