Path: utzoo!censor!geac!maccs!cs4g6ag From: cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) Newsgroups: comp.sys.ibm.pc Subject: Re: Turbo C PUTENV/GETENV Message-ID: <2576CE28.8924@maccs.dcss.mcmaster.ca> Date: 1 Dec 89 19:16:55 GMT References: <2572998E.2456@maccs.dcss.mcmaster.ca> <569@bmers58.UUCP> Reply-To: cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) Organization: McMaster University, Hamilton, Ontario Lines: 23 In article <569@bmers58.UUCP> mlord@bmers58.UUCP (Mark Lord) writes: $Stephen M. Dunn (hey, that's me!) writes of a problem with putenv in Turbo $C $I don't have my DOS references here, but somewhere in the psp is the pointer $to your environment, that both DOS and TURBOC use (offset 16?). A pointer to $your psp is in _PSP, a predefined turbo-c variable that you can use. $The current size is stored in the MCB (memory control block) which immediately $preceeds it in memory (again.. no books = no offset for now..). The pointer is at offset 2Ch, if memory serves ... but I don't have my book here, anyway. [method for solving problem deleted] Actually, someone wrote to me with a better answer, which is that Turbo C doesn't copy your string, it actually just hangs on to the pointer to it, so you can't reuse the variable. Now it works. -- Stephen M. Dunn cs4g6ag@maccs.dcss.mcmaster.ca = "\nI'm only an undergraduate!!!\n"; **************************************************************************** They say the best in life is free // but if you don't pay then you don't eat