--------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2K00049 Date: 02/15/98 From: BOB STOUT Time: 06:57pm \/To: JOHN RICHARDSON (Read 2 times) Subj: Calendar [01/08] On , John Richardson (2:2502/60@fidonet.org) wrote: > If you want my opinion Bob, I wouldn't include rexx scripts. IMO, it's > bad enough having the assembly support routines in there. That's the way my thinking leans as well. --- QM v1.00 * Origin: MicroFirm : Down to the C in chips (1:106/2000.6) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2L00000 Date: 02/16/98 From: ERICH BRAENTNER Time: 06:19pm \/To: ALL (Read 2 times) Subj: good tutorials Does anyone know of a good C tutorial? I am looking for one that isn't quite for beginners but possibly novices...Thanks... --- Blue Wave/386 v2.30 * Origin: The Wizards Realm BBS 1-713-946-7315 1:106/7315 (1:106/7315) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2L00001 Date: 02/16/98 From: ANDREW ZIEM Time: 07:00pm \/To: ALL (Read 2 times) Subj: phonebook program Greetings and Hallucinations, All! I wrote a phonebook program maybe someone else can use. The file structure is very simple, and it can be used for many other things. It could maybe use options for multiple word searchstrings or definable phonebooks, but this works well enough for me. It's also dedicated to the Public Domain, BTW. Excuse the indentation. TC++ does it funny, and I'm lazy. =) === Begin phone.c === /* * Phonebook Search * (K) 1998 by Andrew Ziem * * * [Structure] * * The phonebook is a plain text file, and each entry is simply * seperated by a blank line. * * * [History] * * 98.02.16 -- first release * * */ #include #include #include "rmtrail.c" #include "stristr.c" #define PHONEBOOK "c:\\text\\blckbook." #define MAX_FGETS 128 #define MAX_LINES 12 typedef struct { char entry[MAX_LINES][MAX_FGETS]; int lines; } ENTRY; #define strip_trailing(a) if (a[strlen(a)-1]=='\n') a[strlen(a)-1]=NUL; int main(int argc, char *argv[]) { FILE *fpb; char line[MAX_FGETS], search_str[MAX_FGETS]; ENTRY cur_entry; int cur_line, found; printf("Phonebook Search -- " __DATE__ "\n"); strcpy(search_str, argv[1]); cur_line = 0; cur_entry.lines = 0; found = 0; printf("(K) 1998 by Psych0 \n\n"); if (argc != 2) { printf("usage: enter the search string on the command line\n"); exit(EXIT_SUCCESS); } fpb = fopen(PHONEBOOK, "rt"); if (!fpb) { printf("error: unable to open phonebook\n" PHONEBOOK); exit(EXIT_FAILURE); } printf("Finding `%s'...\n\n", search_str); while (fgets(line, MAX_FGETS, fpb)) { strip_trailing(line); rmtrail(line); cur_line++; if (strlen(line) < 2) { int x; /* blank line, prepare to clear */ /* cycle through entry, find anything intersting */ for (x = 0; x < cur_entry.lines; x++) { if (stristr(cur_entry.entry[x], search_str)) { found++; for (x = 0; x < cur_entry.lines; x++) { printf(" %s\n", cur_entry.entry[x]); } printf("\n"); break; } } /* wipe */ cur_entry.lines = 0; } else { /* add to list */ if (cur_entry.lines < MAX_LINES) { strcpy(cur_entry.entry[cur_entry.lines], line); cur_entry.lines++; } } } /* if (found == 0) { printf(" -- nothing found\n"); } else { printf(" -- %i entries found\n"); } */ fclose(fpb); printf("Done.\n"); return EXIT_SUCCESS; } === End phone.c === Andrew -=- Psych0Tag v0.50 ... "He who is contented is rich." - Lao-Tzu --- GoldED 3.00.Beta1+ * Origin: Psychosis - Psych0Soft - Telegard - OS2 - 719.532.0053 - (1:128/234) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2L00002 Date: 02/01/98 From: ANDREAS THIEDE Time: 10:27pm \/To: MIKKO SIREN (Read 2 times) Subj: WCIDE Hi Mikko! Am 23 Jan 98 22:30 kritzelte Mikko Siren an All: MS> Hi, I got this on problem with WCIDE the WC IDE editor. It works MS> fine, except when I try to complie the program it gives the error MS> [257]. What does this error mean? And how can I fix it? Hi ! I'm the author of WCIDE. (I hope we're talking about the same WCIDE) I cannot give you hints on this problem because I don't know what problem exactly you have. You said you get an error-message when you try to compile your code !?. Is that a Runtime-Error Message ? What version of WCIDE do you have ? What compiler.exe do you use (C, C++, 16 or 32bit) ? Does this error occur when activating [Sources/Make] or [Target/Make] ? cu., drice bye... .=:[Drice]:=. --- GoldED 2.42.G1219 * Origin: (2:2480/645.10) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2M00000 Date: 02/16/98 From: CAREY BLOODWORTH Time: 09:26pm \/To: VICTOR KEMP (Read 2 times) Subj: interrupt function You need to be careful about setting and reading global flags in an ISR. Imagine this situation: flag = 1; /* uart isr was called */ ... stuff .... ... timer isr starts .... if (flag) { flag = 0; ... do what needs to be done ... } return from interrupt or vector to previous interrupt code. ... timer isr ends ... Imagine what might happen if after the timer checks the flag, the uart ISR is done again. Then flag might be two, but timer ISR is clearing the flag. You can't even do flag--; You'll need to disable and then reenable the interrupts around critical code such as setting flags etc. You should also set any global ISR flags (that you use to communicate between ISRs and/or the main program) as volatile, in addition to be declared as 'far'. --- QScan/PCB v1.19b / 01-0162 * Origin: Jackalope Junction 501-785-5381 Ft Smith AR (1:3822/1) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2M00001 Date: 02/16/98 From: CAREY BLOODWORTH Time: 09:26pm \/To: JANI SAKSA (Read 2 times) Subj: Re: QUESTIONS. JS> Ok, I was wrong. It might be 32 or even more... But if you are using JGPP JS> then it will be 16-bits :) JS> So use safely "short" while using DJGPP... Right. As I said, it is usually. And most people (including myself) do go ahead and use short to mean 16 bits, and do fine for years. But it was something that you should at least know, even if it's safe (for a particular compiler) to go ahead and depend on short being 16 bits. --- QScan/PCB v1.19b / 01-0162 * Origin: Jackalope Junction 501-785-5381 Ft Smith AR (1:3822/1) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2M00002 Date: 02/15/98 From: BILL BIRRELL Time: 08:15am \/To: DARIN MCBRIDE (Read 2 times) Subj: ' or " Hey Darin, Of course, if you are already in a comment when a new singlequote or doublequote appears, then that too is skipped until end of comment or line - unless of course, ... :-) Bill. --- * Origin: bill@escan.demon.co.uk (2:2504/200) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2M00003 Date: 02/15/98 From: TOM TORFS Time: 11:42pm \/To: IVAN TODOROSKI (Read 2 times) Subj: 32bit integers to 16bit i Ivan Todoroski wrote in a message to William Mcbrine: WM> In *16-bit* protected mode, you get more total memory, but still have to WM> deal with 64k segments. :-P IT> Why do you get more memory? Because although your segments are still limited to 64K, you can use all addressable memory by using selectors. An in-depth discussion would be more appropriate in 80XXX. 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: 239 C LANGUAGE Ref: F2M00004 Date: 02/17/98 From: BRADLEY MACOMBER Time: 07:06am \/To: ALL (Read 2 times) Subj: IPX advice I need to talk to someone who has actually implemented communications via IPX packets. The specs I have are good, but I am unsure of what strategy I should use in implementation.. What I want to know is: Does the IPX driver have its own buffer for i/o, meaning that I can have my program read and write packets at my leisure? or do I have to read packets ASAP (like with the serial ports), because if my program doesn't read them immediately, they could be overwritten by a subsequent packet...? --- T.A.G. 2.7c Standard * Origin: The Wizards Realm BBS 1-713-946-7315 1:106/7315 (1:106/7315) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2M00005 Date: 02/14/98 From: ROGER SCUDDER Time: 02:36pm \/To: NEIL HELLER (Read 2 times) Subj: BOOLEANS Hello Neil. 10 Feb 98 20:14, Neil Heller wrote to All: NH> Given the function: NH> BOOL NH> invalid_crc(char * pcnd, int length) NH> { NH> return(calculate_crc(pcnd, length) != 0)); NH> } NH> where calculate_crc() is a function which returns an int and BOOL is NH> defined as a system "16-bit Boolean value" (no definition given of NH> "Boolean" that I could find). Would it be proper in this instance to NH> drop the " != 0"? Can boolean have all the values of an int (with NH> only 0 and everything else counting)? I think it works, but I don't think it is good coding style to do it. Even though the definition seems a bit sketchy in that TRUE is a non-zero value, C seems to tell us that TRUE is 1 and FALSE is 0. To test this theory a little code that uses logical operators to force a 1 or 0. #include #define PRINT(n) printf( "%d ",(n)) int main( ) { int val = 18; PRINT(val); val = !val; PRINT(val); val = !val; PRINT(val); return 0; } What I do, in a situation like you have above, is to use Bob's macro in sniptype.h TOBOOL(x) (!(!(x))) -Roger ... I am Bugs Bunny of Borg. What's up, Collective? --- Msged 4.20 beta 3 * Origin: Hodge-Podge Support BBS, Upper Darby, Pennsylvania, USA (1:273/404@fidonet)