--------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00007 Date: 03/06/98 From: NAVIN PAI Time: 01:08pm \/To: CARLTON WALTERS (Read 2 times) Subj: what's happening On 03-01-98 14:30, John Richardson & Carlton Walters were talking about what's happening JR>Hi Carlton, Hi John JR> signed short var1; JR> unsigned short var2; JR>and then do: JR> var1 = var2 = %111111111111; /* I'm can't remember off hand the JR> correct way to indicate a binary JR> value in C this is my best guess :) JR> */ JR>var1 would contain the value -32767 whereas var2 would contain 65535. JR>A signed variable is usually the default so there is mostly JR>no need to specify 'signed'. to represent a binary no in c there is no other way than to convert it into a hexadecimal no and then represent it using hexadecimal notation. even if ur representation is considered to be hypothetically correct the contents of var1 and var2 would be same i.e. 4095. to get the values of -32767 and 65535 u should add four more one's, to get, in all 16bits. now it's just 12 bits. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * He's been indoors so much that he's developed traffic lig --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00008 Date: 03/06/98 From: NAVIN PAI Time: 01:54pm \/To: RUSS WUERTZ (Read 2 times) Subj: Re: Has anyone? On 03-03-98 06:18, Russ Wuertz & Edward Brophy were talking about Re: Has anyone? RW> Disk Operating System, or just Operating System 2, is RW>Bios dependent right? wrong. no operating system is bios dependent. every operating system is processor dependent; indirectly or directly it is hardware dependent. RW> It has the BOOT up CODE that puts certain certain RW>routines into memory right at boot up, that can be later RW>used as interupts. the code stored in firmware is the code which does a whole lot of things rather than just providing the routines for the users to be called as interrupts functions. it's up to the user to whether he should use the routines provided by the bios or do the direct control of peripherals himself. RW> In other words the C code we write uses the routines in memory. RW> Cfunction() RW> { RW> int 14 RW> ret RW> } RW> RW> That function would be Operating System dependent and can be run o RW>on the operating system that uses that interupt routine. the above function would be allowed to run on the os which allows to access the bios functions directly. for eg. consider the case of unix os running on a ibm clone. unix also uses the bios fuctions provided by the firmware but it does not allow programmers to access the bios interrupts instead it handles these interrupts itself and provides the programmer equivalent functions for those interrupts. this function is ok on dos, os/2 and windows as it allows programmer to access the bios functions. RW> RW> That Dr-Dos you mention can be run on IBM/OS2 and DOS RW>clones then, right? I am just wondering if there is such wrong again. the dr-dos can be run on the systems which are ibm compatibles. how can u run one operating system on the top of another operating system. the dr-dos cannot be run on a system using a motorola processors or any other processor, unless and until they are coded for that processor. RW>an operationg system and commpilers that are not operating RW>system dependent. Thats the compilers I and we should RW>use if it is available. i didn't get it. how can there be operating system which is not operating system dependent. this statement is totally meaningless.whereas all the compilers are os independent. like c is availabe on dos paltform as well as apple platform. a program written in c to add two nos in both of the platform will do the same thing regardless. but the code generated from the c compiler on dos platform will not run on apple platform and vice-versa. although i don't know much about java i think it is an exception in this case. the code generated in java can be executed in both the platforms. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * Fun, fun, fun, 'til her daddy takes her Blue Wave away! --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00009 Date: 03/06/98 From: NAVIN PAI Time: 01:54pm \/To: EDWARD BROPHY (Read 2 times) Subj: Re: Has anyone? On 03-03-98 06:18, Russ Wuertz & Edward Brophy were talking about Re: Has anyone? RW> Disk Operating System, or just Operating System 2, is RW>Bios dependent right? wrong. no operating system is bios dependent. every operating system is processor dependent; indirectly or directly it is hardware dependent. RW> It has the BOOT up CODE that puts certain certain RW>routines into memory right at boot up, that can be later RW>used as interupts. the code stored in firmware is the code which does a whole lot of things rather than just providing the routines for the users to be called as interrupts functions. it's up to the user to whether he should use the routines provided by the bios or do the direct control of peripherals himself. RW> In other words the C code we write uses the routines in memory. RW> Cfunction() RW> { RW> int 14 RW> ret RW> } RW> RW> That function would be Operating System dependent and can be run o RW>on the operating system that uses that interupt routine. the above function would be allowed to run on the os which allows to access the bios functions directly. for eg. consider the case of unix os running on a ibm clone. unix also uses the bios fuctions provided by the firmware but it does not allow programmers to access the bios interrupts instead it handles these interrupts itself and provides the programmer equivalent functions for those interrupts. this function is ok on dos, os/2 and windows as it allows programmer to access the bios functions. RW> RW> That Dr-Dos you mention can be run on IBM/OS2 and DOS RW>clones then, right? I am just wondering if there is such wrong again. the dr-dos can be run on the systems which are ibm compatibles. how can u run one operating system on the top of another operating system. the dr-dos cannot be run on a system using a motorola processors or any other processor, unless and until they are coded for that processor. RW>an operationg system and commpilers that are not operating RW>system dependent. Thats the compilers I and we should RW>use if it is available. i didn't get it. how can there be operating system which is not operating system dependent. this statement is totally meaningless.whereas all the compilers are os independent. like c is availabe on dos paltform as well as apple platform. a program written in c to add two nos in both of the platform will do the same thing regardless. but the code generated from the c compiler on dos platform will not run on apple platform and vice-versa. although i don't know much about java i think it is an exception in this case. the code generated in java can be executed in both the platforms. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * Fun, fun, fun, 'til her daddy takes her Blue Wave away! --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00010 Date: 03/07/98 From: NAVIN PAI Time: 08:36am \/To: EDWARD BROPHY (Read 2 times) Subj: Re: Has anyone? On 03-03-98 21:09, Edward Brophy & Russ Wuertz were talking about Re: Has anyone? -> It has the BOOT up CODE that puts certain certain routines into -> memory right at boot up, that can be later used as interupts. -> In other words the C code we write uses the routines in memory. -> Cfunction() -> { -> int 14 -> ret -> } EB>Non-PCs still use interrupts and bios-like hardware coding, EB>although I'm not very knowledgeable on how the processor EB>knows which instruction is to be the _very first_ one when EB>it is first powered up. when the processor is first powered up the first instruction it fetches is from the memory location ffff:0000 u can check it out by following the steps 1. start debug by typing command 'debug' 2. type 'a' 3. press enter 4. type 'g' ur system will reboot. this will work in dos mode only. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * I had a life once...now I have a computer and a modem! --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00012 Date: 03/11/98 From: NAVIN PAI Time: 11:54pm \/To: TOM TORFS (Read 2 times) Subj: Add On 03-06-98 22:24, Tom Torfs & Navin Pai were talking about Add TT>Navin Pai wrote in a message to Qmail: TT>I'll just reply in public because I have no idea when (if) TT>netmail to zone 6 would arrive... TT>You posted several meaningless/empty messages containing TT>subject lines "Add" or "Drop" in the C_Echo. Please make TT>sure it doesn't happen again... i am sorry for that. actually i was testing my new qwk mail viewer. somehow accidently, but not purposefully i clicked on the add and drop buttons and that explains it. yup. it wont happen again. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * FLOOR: (n) The place to store your backup floppies. --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00013 Date: 03/12/98 From: NAVIN PAI Time: 12:33am \/To: WAYNE GREER (Read 2 times) Subj: Has anyone? On 03-07-98 22:18, Wayne Greer & Navin Pai were talking about Has anyone? NP>JD>I was wondering if anyone has seen a pc program that does not use NP>JD>an operating system. NP> Yes. i've. NP> infact i've written such a commercial program myself. WG>Would you like to share the 'how to' part with the rest of us? sure. i'd be glad to. firstly let me tell u abt the program. it was partially coded in assembly and partially in c. the prog reads the data from the serial port and aintains the record of it and prints the bill. the data avail from the port is ctually sent by the digitizer which is interfaced to a weighing bridge used for measuring weight of trucks. here's how part before proceeding for writing such program i analysed the boot sector of a a dos diskette(bootable or unbootable). i read the boot sector and stored it in the file. after that i disassembled the code stored in the file using sourcer. sourcer is a prog to disassemble any executable or binary file and generate a documented source in assembly lang. if u don't have sourcer u can do it using debug too. i studied the listing and managed to write a bootstrap code myself. only this much is assembly rest all is in c. for c part. i simulated a 1.2 mb file on my hdd as my diskette and proceeded to write a conventional c prog w/o using any of the standard library functions provided by the c compiler. instead of generating the object code from the compiler i generated the assembly source and assembled it along with the bootstrap code to generate the binary image of the executable. that's it. after that i wrote a seperate prog in c to transfer the binary image on to a 1.2mb diskette and the diskette was ready to be used. obviously the diskette has to be changed every three months. too confusing isn't it. well it took me almost 3 week to write such a prog. if there's anything more u want to know i'd be glad to help. well here's something for u to test out. /* by Navin Pai */ #include void main() { FILE *fp; int s, e; char st[] = { 0xb4, 0x1, 0xb5, 0, 0xb1, 0, 0xcd, 0x10, 0xcd, 0x20 }; printf("\nEnter start & end scan row[1 to 7 for cga, 1 to 14 for vga]: "); scanf( "%d %d", &s, &e ); st[3] = (char) s; st[5] = (char) e; fp = fopen( "cursor.com", "wb" ); fwrite( &st, sizeof(st), 1, fp ); fclose( fp ); } after executing this program run the file cursor.com at the dos prompt to change the shape of cursor. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * This BBS has achieved Air superiority. --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00014 Date: 03/12/98 From: JOHN DUMAS Time: 02:35pm \/To: G.W. || ALL (Read 2 times) Subj: Re: Avoid disaster -=> Quoting George White to John Dumas <=- GW> That is definitely your problem. C will not protect the programmer GW> from himself! I am trying to do just that. JD> I need a function put in C like. JD> char string[4]; JD> if( CheckLimit( string,lenstr("OUCH")) JD> ^^^^^^^^^^ GW> if (sizeof(string) > strlen("OUCH")) JD> strcpy( string,"OUCH"); ^5 JD> else JD> ErrorRoutine(); JD> I guessing but since there is a free command the size of the JD> variables must be held somwhere. Where? GW> free() only works against memory that has been allocated using GW> malloc(). The heap management routines maintain internal information GW> about the size of the block of data used (which is _always_ greater GW> than the size requested as it includes the control data & is rounded to GW> position the blocks on data boundaries giving efficient access) but I GW> don't believe there is any official way to access the information. I do not have the C rules on how the "internal information" on memory blocks are stored. It is probally one of those things that is left up to the compiler makers descretion. I guess the best thing to do if you are recieving an unknown length variable via a pointer is to copy it char by char into a third variable and then use it as the source. int CopyStringLessThan ( char *UnknownSource,char *MyString,int limet ) { int y=0; char tempstring[limet]; while( UnknownSource[y] && y TOPIC: 239 C LANGUAGE Ref: F3I00015 Date: 03/11/98 From: AUKE REITSMA Time: 09:25pm \/To: JOHN DUMAS (Read 2 times) Subj: Avoid disaster Hi John, On 10 Mar 98, 13:32, you wrote to 0+=ALL JD> BB Free() is just the counterpart of malloc(). JD> I know what free does but how does it do it. JD> It has the starting address of the passed variable &variable[0]. JD> How does it know where it ends ??? When a section of memory is allocated by malloc() or calloc() it also records the size of the allocated section. So free() just looks at that recorded ze. Greetings from _____ /_|__| Auke Reitsma, Delft, The Netherlands. / | \ -------------------------------------- --- GEcho 1.00 * Origin: Home by the C (Auke.Reitsma@net.hcc.nl) (2:281/400.20) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F3I00016 Date: 03/10/98 From: BILL BIRRELL Time: 07:41am \/To: TOM TORFS (Read 2 times) Subj: Avoid disaster > Just a minor nitpick: C standard library functions > should be lowercase, even when they're at the start of > a sentence :-) Wrong, Tom! In a program, yes; in prose, no. As moderator you are free to change the echo rules, but not to change the rules of prose composition in English. That's for people like Will Shakespeare, James Joyce and Damon Runyan. :-) Bill. --- * Origin: bill@escan.demon.co.uk (2:2504/200)