--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00014 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 12:30am \/To: JASON PETTY (Read 2 times) Subj: door library for c++ JP> anyone know where a good door library for making door games thats JP> freeware for c++? i don't know but if you're talking specifically about dos, then make sure it uses the FOSSIL driver; there are lots of doors that simply won't work just because you have a weird modem setup (irq's) and the programmer's endless pride told him to write everything from scratch, ending up with a crappy modem driver separate in every single door, each of which crashing the whole machine once every 2 weeks, when functioning at all (several doors didn't support over com2:, some others didn't support alternate irq's, and most of all doors didn't support multimodem cards) now a door game interface would just be a layer on the top of this that allows for easy manipulation of common terminal protocols such as ansi/vt-100, avatar, rip, and also doorfiles, user privileges, user time limit, user names, and such? is this for personal use or wide use? would you mind using instead a script language like MEX which is embedded into Maximus? matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00015 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 12:48am \/To: ROBERT DAVIES (Read 2 times) Subj: I do not under srand this can anyone enl00:48:2702/05/98 RD> understand. If you have a look at lines nine and ten RD> cout << 1.e3 << endl; // 1000 RD> cout << 1.e-3 << endl; // 0.001 RD> Does 1.e3 mean one multiplied by a thousand, and 1.e-3 mean one RD> multiplied by RD> minus a thousand? yes. it's scientific notation. e2 is *100, e1 is *10, e0 does nothing, e-2 does /100, e/5 does /10000, e12 does *1000000000000, and so on. In scientific notation, at the right of the e stands a number which is used as an exponent to the current base (10) and multiplied by the number at the left of the e which is called the mantissa. incidentally, floating point processors use a similar scheme to store and compute values. a 'float' number has something like 23 bits of mantissa which is always in the interval 0.5 < x < 1 (either that or 1 < x < 2) and an exponent of 8 bits that goes from -128 to +127 or nearly that; the base is 2. there is one sign bit and that sums up to a total of 32 bits. another standard is the 'double' format, 64-bit (52,11,1). other formats are optional and/or redundant. Long ago, several large companies had their own formats. Also, the 'long double' format on PC's is 80 bits (63,15,1, and 1 bit wasted), but is not guaranteed of existing (or being the same) on other machines, where the biggest might be 64 bit, or 96 bit, or 128 bit. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00016 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 12:57am \/To: TIM HUTZLER (Read 2 times) Subj: Re: sending AT commands TH> JDBP>ofstream modem("COM3", ios::out|ios::binary) ; TH> JDBP>modem << "ATZ\r" << flush ; TH> Thanks, I tried that out. But I get a linker error. TH> I am compiling for DOS. I am using Borland 3.0 for DOS. TH> What I would like to see is a simple application demonstrating a TH> functional, working example of manipulating the modem. I only need to TH> send AT-dialing commands to automate banking transactions and such. Though the error is not related to what i'm saying, consider using a Fossil driver. The com port device pseudofiles com1: through com8: are quirky under DOS and shouldn't be used for serious purposes. On the other hand, rewriting the stuff is long, takes serious debugging time and isn't very good. Using a library is not as stable as using a driver, especially since some drivers, like BNU, were thoroughly tested and this one is probably still popular (EVEN THOUGH there were no official versions since 1989 -- the 1.70 release was really stable). Using a C library might be easier, though, especially if stability is not your greatest concern, which is probably the case.. Another solution, which is probably the best suited to your particular problem: If you're using a telecom package such as Telix or Terminate, there's an embedded script language. Telix's SALT looks like a simplified C; Terminate's language looks like a blend of pascal, basic, and C. I couldn't give more details, because i don't remember much of it. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00017 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 01:11am \/To: ADAM MAJER (Read 2 times) Subj: converting char to string AM> HB>char charvar; AM> HB>char stringvar[90]; AM> HB>char stringret[91]; AM> HB>sprintf(stringret, "%s%c", stringvar, charvar); AM> This takes a long time to execute though AM> int i = strlen(stringvar); AM> stringvar[i++] = charvar; AM> stringvar[i] = NULL; AM> The above is much faster. ;-) Yet Another Way To Do It : sprintf(stringvar + strlen (stringvar), "%c", charvar); matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00018 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 01:15am \/To: JONATHAN DE BOYNE POLLARD (Read 2 times) Subj: Sort Algorithm DN>> Note that bubble sort is offered by Knuth, and several others, as by DN>> far the worst sorting algorithm around. The next step up is insertion DN>> sort, which typically runs twice as fast. The "great all-rounder" is DN>> Shell's algorithm. The "formula 1 racer" is Hoare's algorithm DN>> (usually very fast, but is prone to breaking down). The "status DN>> symbol" of sorting is Batcher's algorithm. JdBP> Whenever I need to code a sort of my own (as opposed to just using JdBP> qsort()) I JdBP> use Comb Sort. It's reasonably fast, and it is uncomplicated and small JdBP> enough that it is easy to remember. what is the comb sort? and Batcher's algorithm? (in short... just the algorithms in pseudocode, details are ok but not necessary) matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00019 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 01:19am \/To: JONATHAN DE BOYNE POLLARD (Read 2 times) Subj: converting char to string JdBP> Or, idiomatically : JdBP> char ch ; JdBP> char str[2] = { ch } ; does that guarantee that str[1] == 0 ? matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00020 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 01:24am \/To: BRIAN WOOD (Read 2 times) Subj: '/a'=? BW> No, no error, and '/a' is what I meant, but I think you're right. A BW> compiler should post an error or at least a warning, IMHO. I started BW> using two char constants a couple years ago, not realizing it was a bad BW> idea, and not at all portable evidently... Now I'd like to rewrite all BW> the code that uses this type, and I'm looking for the best way. in Perl language, while (<>) { print if /'..+'/; } will find all of your '' pairs with 2 chars or more in them... the pattern should be a little more elaborate because it currently doesn't care for cases where you got two ' pairs on the same line, and will match the second and third, and doesn't handle comments, but it's probably much better than just searching for single apostrophes :-) incidentally, it's even shorter in awk language: /'..+'/ { print } and even shorter in sed language, though i don't remember the syntax. Since both Perl and Awk are much influenced by C/C++ syntax (at least at a larger scale than this problem), this is about 40% on topic :-) Also, you can use Grep, either the GNU one or the Turbo (Borland) one that comes with every TC or BC. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00021 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 01:33am \/To: ERIC LONDAITS (Read 2 times) Subj: sort.cpp EL> I just compiled it and works for me... CF>> void main() EL> I would do EL> void main(void) EL> but then, that's just me... :) if your compiler doesn't complain it EL> shouldn't be reason enought for the program to stop execution. the correct and idiomatic way of writing a main when you don't use any parameters is: /* K&R C */ main () { /* ANSI C */ int main (void) { // C++ int main () { when you do use parameters, it's: /* K&R C */ main (argc,argv) char *argv[]; { /* ANSI C, all C++ */ int main (int argc, char *argv[]) { though **argv is considered correct. return type is always int. you return 0 if the program is correct. assign a non-zero value to each error situation your batchfiles should know about. Most programs giving a visual result should always return 0 since almost never will their values be useful to batchfiles, but i say *most*. incidentally, in Java, though not a direct evolution of C/C++, uses the following syntax: public static void main (String[] args) { which means that someone at Sun Microsystems hates batchfiles. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00022 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 01:44am \/To: CYBER CON (Read 2 times) Subj: C++ Saveding stuff CC> so could someone write me a exp. program that does the following. CC> input "Enter Name " , name$ CC> if name$ = "Cyber Con" then print "Hi Cyber Con" CC> open "file1.fil" as 1 CC> put 1, name$ CC> Close CC> END CC> //' next program CC> open "file1.fil" as 1 CC> get 1, name$ CC> print name$ CC> END for that kind of thing use Perl instead; C/C++ is better suited for heavy-duty calculations such as image processing, sound processing, operating systems, interpreters, ... in classic C++: #include int main () { cout << "Enter Name "; char name[80]; cin >> name; if (strcmp (name, "Cyber Con") == 0) cout << "Hi Cyber Con\n"; ofstream f1("file1.fil"); f1 << name << "\n"; return 0; } in Perl: print "Enter Name "; flush stdout; $_ = <>; print "Hi $_" if /Cyber Con/; open F1 ">file1.fil"; print F1 "$_\n"; close F1; in sh language: echo Enter Name: read name if [ "$name" == "Cyber Con" ]; then echo Hi $name; fi echo $name > file1.fil the 2nd part, C++: int main () { ifstream f1("file1.fil"); char name[80]; f1 >> name; cout << name << '\n'; return 0; } in Perl: open F1 "file1.fil"; print scalar(); close F1; in sh language: head -1 file1.fil or assuming there's really only 1 line in that file: cat file1.fil matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F2F00023 Date: 02/05/98 From: MATHIEU BOUCHARD Time: 02:19am \/To: RON BASS (Read 2 times) Subj: Re: converting char to string MB>> NULL is defined as being of type void *. RB> This may be true in C, but in C++, if NULL is defined at all it is . . . RB> Under C++, the constant integer 0 is the only valid way to represent a RB> NULL pointer that can be used with any type of pointer. thank you very much for this precious info matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)