Subject: Re: Need help with c! Approved: clc AT plethora DOT net References: From: Francis Glassborow X-Newsreader: Turnpike (32) Version 3.05 Organization: Southfield Microcomputer SS Lines: 32 Mime-Version: 1.0 Newsgroups: comp.os.msdos.djgpp,comp.lang.c.moderated Message-ID: Originator: clcm AT plethora DOT net (Comp Lang C'Moderated) Date: Sun, 24 Jan 1999 04:31:54 GMT NNTP-Posting-Host: 205.166.146.5 X-Trace: ptah.visi.com 917152314 205.166.146.5 (Sat, 23 Jan 1999 22:31:54 CDT) NNTP-Posting-Date: Sat, 23 Jan 1999 22:31:54 CDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article , Francis Glassborow writes >For the benefit of other readers, in an offline exchange I have >ascertained that mohan is trying to execute his code with Windows98 >without realising that such code must be run in a DOS Box I have just been asked to extend this comment. I will be brief because it is OS specific. Windows98 is a multitasking system which really hates programs that try to get at external resources (such as files) behind its back. You can compile your code as a console program if your compiler provides support for this (of course you could always torture yourself by doing it for yourself, but I am not such a masichist) Of course the compiler will happily compile calls to scanf, and the linker will generate an executable. However any attempt to execute the result is doomed (unless it was compiled for and run under DOS). In the case in question the reason that the executable did not immediately fall over when the input file was missing was that the FILE* was NULL (I think there were still problems, but not such obvious ones as far as the OS was concerned) IF you want to learn C using Windows98 the investment in a compiler that directly supports the OS is worth it. If you are a student or teacher/instructor check MetroWerks' academic licence and cost they really are a bargain for an excellent package (which even includes Pascal and, I believe, Objective C) Francis Glassborow Chair of Association of C & C++ Users 64 Southfield Rd Oxford OX4 1PA +44(0)1865 246490 All opinions are mine and do not represent those of any organisation -- comp.lang.c.moderated - clcm AT plethora DOT net