HDTenEightyP/NetNews huggingface dataset:
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: Borland C++ 3.0 scanf()/gets() bug.
Date: Sat, 25 Jul 1992 12:39:10 GMT
Organization: D'Arcy Cain Consulting

danc@loon.geog.ubc.ca (Dan Ciarniello) writes:
>I've come across what I believe is a bug in Borland C++.  The following 
>program fragment does not work as one would expect.
>        scanf("%s", var1);
>	gets(var2);

Nope.  You found a bug in your program.  Actually there are two bugs
in the above code.  To find the bugs I mean add the following flags
to your compile command:

    -Dscanf=NEVER_USE_SCANF -Dgets=NEVER_USE_GETS

If you do this in all of your programs you will save yourself much grief.
The call to scanf is doing exactly what it is supposed to do.  The way
to do what you want is:

    fgets(buffer, sizeof(buffer), stdin);
    sscanf("%s", var1);
    fgets(var2, sizeof(var2), stdin);

CAUTION:  The above assumes that buffer and var2 are character arrays,
not pointers.  Replace sizeof to something appropriate if that is not
true.

BTW the fgets over gets issue is to cover the times that someone leaves
a book resting on the keyboard while they answer the phone.

-- 
D'Arcy J.M. Cain (darcy@druid.com)  |
D'Arcy Cain Consulting              |   There's no government
Toronto, Ontario, Canada            |   like no government!
+1 416 424 2871          DoD#0082   |
From: phil@cs.utexas.edu (Philip Smolen)
Newsgroups: comp.os.msdos.programmer
Subject: Re: #include <iostream.h> cout "Hello World\n" hassle (kindergarten prob, I guess)
Date: 26 Jul 1992 23:30:07 -0500
Organization: U Texas Dept of Computer Sciences, Austin TX
NNTP-Posting-Host: muleshoe.cs.utexas.edu

In article <0095E0C9.C1EA64E0@Msu.oscs.montana.edu> imsks126@Msu.oscs.montana.edu writes:

>What am I doing wrong? If I #include <iostream.h> I can
[working program deleted]
>void main(void){                   void main(void){
>  char str[6];
>                                     cout << "Uga Buga";
>  str = "Uga Buga";                  }
>  cout << str;
>  }
>
>in both cases I get linker error "undef symbol in ostream:: etc."

Strange.  I compiled the last two programs just now and got exactly what I
expected.  The one on the left wouldn't even compile.  (An array name is
a constant pointer, and thus not an lvalue.)  The one on the right printed
the message on the screen.  I am using CC on a SUN/SPARC.

Perhaps the problem is in your compiler or the way you set it up.

                                        --Phil
Newsgroups: comp.os.msdos.programmer
From: jim@n5ial.chi.il.us
Subject: Re: changes to exe (binary) file
Originator: jim@eddie
Reply-To: jim@n5ial.chi.il.us
Organization: me?  have you seen my desk?  : -)
Date: Thu, 30 Jul 1992 17:34:12 GMT

In article <1992Jul30.152020.8261@menudo.uh.edu> cosc16to@menudo.uh.edu
(Andy Hakim) writes:
> 
>void fsavedefaults(char *program_name)

>The program  can be obtained from most ftp sites as nohiss10.zip.  I'd be
>happy to provide the full source code via email.

thanks!  and thanks again also to the folks who replied by e-mail.

I now have a version working under UNIX (only took a few minutes, even),
but it doesn't seem to work with turbo c++ 1.0.  what a surprise....turbo
c++ fails once again....  oh well, I've got a good start now.

oh, and some heard this via e-mail, but....  once again, ask a question on
the net, and within 24 hours, lots and lots of replies....  and some people
wonder why people think UseNet is worth anything.....  :-)

btw, the way I setup the version that works fine under UNIX is basically
to read the binary into a buffer (fopen'ed, of course, in binary mode),
search for the string you want to replace, determine the offset, and
then replace that with the new version of the string.  what I did, however,
was simply to write the data (all of it) back out to the file, and when I
got to the chars that were to be changed, I inserted the new values instead
of the buffer's values.

only problem with this under turbo c++ 1.0 is that it refuses to open the
file in binary mode...first time it sees a ^Z (around 9k or so), that's
it.  this applies for open and fopen.  does anyone know if there's a patch
for this?  or is there something screwy I'm missing?  (yeah, I know, opening
myself up for major puns there....)

thanks all!
   --jim

\input std_disclaimer                     % 73 DE N5IAL (/9)
------------------------------------------------------------------------------
"[...] the plural of `mongoose' ought to be `polygoose'." [Jargon file 2.9.10]

INTERNET:  jim@n5ial.chi.il.us  |  grahj@gagme.chi.il.us  |  j.graham@ieee.org
UUCP:  gagme!n5ial!jim@clout.chi.il.us
AMATEUR RADIO:  n5ial@n9hsi (Chicago.IL.US.Earth)
------------------------------------------------------------------------------

Newsgroups: comp.os.msdos.programmer
From: mt@kram.demon.co.uk (Mark Turner)
Subject: Writing 'Windows friendly' programs.
Distribution: world
Organization: Demon Systems Limited / Demon Internet Services
Date: Tue, 28 Jul 1992 21:26:03 +0000

Is there an 'approved' or 'recommended' way for a DOS program to say
something along the lines of "Oy, Windows (if you're there).... I won't
be needing any processor time for X milliseconds/seconds" ?

I can't go away and wait for a key for a specified period because the
program in question looks for various events happening and isn't really
interested in key-presses most of the time.

Any hints, or pointers towards a more suitable area to ask, are welcome.

	Regards,
		Mark.

/\/\ark Turner                               Demon Systems / Demon Internet
Office: mark@demon.co.uk (+44 81 349 0063)       42 Hendon Lane, London
Home: mt@kram.demon.co.uk (+44 831 823 212)         N3 1TT, England
From: econz@vax.oxford.ac.uk
Newsgroups: comp.os.msdos.programmer
Subject: MS C/C++ 7 disappointments
Date: 29 Jul 92 10:55:00 GMT
Organization: Oxford University VAXcluster



  I have a large Dos application which I developed using MSC 6. Having
read the review in Microsoft Systems Journal I was quite excited
to receive MS C/C++ 7. Unfortunately it turned out to be a disappointment.
I am programming for Dos, using C only.

- First of all, the marketing section forgot to point out that you cannot
  combine p-code and overlays in one program. Even Microsoft Technical
  Support was surprised about this. It seemed ideal: p-code part of the
  root, overlay the separate tasks. I would be happy if someone proved
  me wrong on this point.
- The Exepack option (LINK) doesn't work with overlaid programs, they
  just hang at start-up.
- Codeview keeps on hanging on overlaid programs (I'm using the new
  dynamic overlay system, called MOVE). It hangs when CV tries to load the
  executable, but sometimes works when changing which files have
  debugging on. Usually the program works normally,
  but on one occasion it hang on exit (which made my think there's 
  something wrong with CVPACK). 
  I installed 386max, and tried it under Windows 3.1 as well ("This program 
  has violated system integrity due to an invalid general protection fault
  and will be terminated").
  This is the worst bit, I cannot write programs without a debugger, and
  the program takes too much memory without overlays.
- I didn't manage to get the function level linking (/Gy) working.
  With function level linking, all functions end up in a COMDAT
  segment, instead of a file_TEXT segment. This should enable the
  linker to throw out unused functions, and gives the option to
  allocate individual functions to an overlay (this is what I tried). 
  I gave up after a while, because after the previous problems I 
  tended to blame Microsoft rather than myself.
  It brought up a question: Does anybody know how the linker resolves
  functions which have the same name (it doesn't seem to make a difference
  whether functions are static or not).

My conclusion is that the compiler seems to be fine, but that the tools
are pretty unstable. I hope that the Windows tools are better.

To end on a positive note: I have a 32-bit version of the program using
Watcom C 9.0/386. It took a little time to convert the assembler part of
my program, but it's all working fine. No problems linking or debugging at all.
My only wish is that they make the debugger interface more similar to Codeview. 

I'd be very interested to hear other people's experience.

Jurgen Doornik
Newsgroups: comp.os.msdos.programmer
From: kibirev@csa.bu.edu (oleg kibirev)
Subject: Re: fast memcpy
Organization: Computer Science Department, Boston University, Boston, MA, USA
Date: Tue, 21 Jul 1992 16:26:18 GMT
X-Posted-From: csa.bu.edu
X-Posted-Through: sol.ctr.columbia.edu

In article <1992Jul19.234636.25680@ccu1.aukuni.ac.nz> stuartw@ccu1.aukuni.ac.nz (Stuart Woolford) writes:
>
>in microsoft ( 5.0 and 6.0, atleast... ) a memcpy is done with an inline
>string move instruction, ie:no call overhead, short of using DMA, there
>is no way of going faster ( I think it uses word move, but could be wrong.. )
>
So, each time you use memcpy, optimization is turned off for the entire module?
Or it's only Borland's reacrion to ASM? I think there is a way to do it faster
(sometimes): checking if the start of both source and dest are misaligned and
fixing it with single movsb before doing word move. 

DMA won't be faster on anything better than 4.77MHz PC: it operates at 4MHz on
all later machines.

Oleg Kibirev


Newsgroups: comp.os.msdos.programmer
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: comp.os.msdos.programmer FAQ diff 4 of 4
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Sat, 25 Jul 1992 16:38:55 GMT

A sharp-eyed reader noticed that there are two different ftp addresses
given in part 4 for pit-manager.  The correct address is 18.172.1.27;
this will be included in the regular text (and diffs) part 4 next
month.
-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG

"Tariff, n.  A scale of taxes on imports, designed to protect the
domestic producer against the greed of his consumer."  --Ambrose Bierce
Newsgroups: comp.os.msdos.programmer
From: otto@nevada.edu (Frederick J. Haab)
Subject: Re: floodfill problem.
Organization: University of Nevada System Computing Services
Date: Tue, 21 Jul 1992 18:27:32 GMT

In article <1434@grivel.une.edu.au> scavanag@neumann.une.edu.au (Steven Cavanagh) writes:
>	I'm writing a simple game using Borland C++ 3.0, and
>without going into too much detail, I need a section of the viewing
>screen that is already filled coloured black (ie, only part of the
>filled section is to be coloured black, effectively erasing it).
>I setcolor(EGA_BLACK); draw the boundaries of the area using lineto,
>and then floodfill(x,y,EGA_BLACK) inside this region. When the 
>program runs the lines are drawn okay, but the region is not filled
>in. I have checked the use of floodfill() and the coordinates, but
>cannot figure out why it isn't doing it.
>
>Can anyone help?
>
>	Cav.

I don't have Borland C++, I have Turbo C++, if they are similar then
you may have a function called fillpoly(...).  I don't know why
floodfill doesn't work, but even in my manual it suggests using
fillpoly whenever possible, and also floodfill doesn't work
on 8514 drivers.

	-Fred
Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.hardware,comp.forsale,comp.sys.ibm.pc.misc,comp.sys.ibm.pc.wanted
From: scott@mycro.UUCP (Scott C. Sadow)
Newsgroups: comp.os.msdos.programmer
Subject: Re: screen saver routines
Date: 25 Jul 92 19:27:06 GMT

In article <1992Jul22.161607.3668@magnus.acs.ohio-state.edu>, news@magnus.acs.ohio-state.edu writes:
>
>   I'm planning on incorporating a screen saver into my program.
>From what I gather, I'll need to hook onto 2 interrupts, 0x1C and
>0x09.  My hook to interrupt 0x1C will increment a counter every
>time it is called and if the counter is greater than a certain
>amount of time, blank the screen.  My hook to interrupt 0x09 will
>unblank the screen and clear the counter if the screen is already
>blanked, otherwise it will just clear the counter.  Can someone
>tell me if this will work or have any suggestions/improvements?
>Thanks!
>
>-Sam-


Sounds good - I have written a TSR that uses that method (It is a very
common method)  Some comments though:

   1) You should use a flag to indicated that the screen is blanked. Then
check this flag in the 0x1C handler to see if there is anything to do. (If
blanked, just return...)

   2) Be aware that some nasty, unfriendly programs (like windoze) take
over the 0x09 interrupt so your program will not see any keystrokes. I
know this because I wrote a screen saver TSR that caused problems because
it didn't see any keyboard activity.

   3) If you are not writing the interrupt handlers in assembly, make sure
you do as little as possible. (Actually, even if you are writing them in
assembly) The timer tick and keyboard interrupt handlers can adversly
affect system response/performance.


   Scott C. Sadow
   scott@mycro.UUCP
   ...gatech!nanovx!mycro!scott
From: roo@dstos3.dsto.gov.au
Newsgroups: comp.os.msdos.programmer
Subject: redir output of child in MS-FORTRAN ?
Date: 23 Jul 92 16:00:05 GMT
Organization: Defence Science and Technology Organisation


I have a program written in MS-FORTRAN which runs another program as a child and
needs to redirect the screen output of the child --- currently to NUL, but it is
envisaged allowing to a file.

I am doing this via

     I = SYSTEM('prog > NUL'C)

which is the documented in the MS-FORTRAN ``Advanced Topics'' and uses the
MS-C system call.

Now, the program I am running as a child uses a large amount of memory (about
400K), so I have used the SPAWNO replacement for the system call (speaking as a
satisfied user, that's a great package BTW).

Now, because of the size of the child, I would prefer to be even more miserly
with memory, and do without losing even the 3K or so which COMMAND.COM takes up
because of the system call. So I would prefer to do something along the lines of

      CALL redirect_output(file_or_device)
      I = spawnlpe(args)


To make things more difficult, I do not have a MS-C compiler handy (for wierd
and wonderful admin reasons we use Turbo/Borland C and MS-FORTRAN around here),
so I can't use solutions which have been given in a similar thread recently on
redirecting input and output, unless there is a good way to access Turbo C from
MS-FORTRAN.

Any advice/pointers/RTFM's will be much appreciated.

----------------
Robert O'Dowd                              Phone  : +61 8 259 7132
Bldg. 64 TSAN,  AS/MOD                     Fax    : +61 8 259 6104
P.O. Box 1700                              E-mail : roo@dstos3.dsto.oz.au
DSTO Salisbury, South Australia               OR    roo@dstos3.dsto.gov.au
                                              OR    roo@mod.dsto.gov.au
Std Disclaimer: Opinions above are MINE, probably worth what you paid for them.

-- 
----------------
Robert O'Dowd                              Phone  : +61 8 259 7132
Bldg. 64 TSAN,  AS/MOD                     Fax    : +61 8 259 6104
P.O. Box 1700                              E-mail : roo@dstos3.dsto.oz.au
DSTO Salisbury, South Australia               OR    roo@dstos3.dsto.gov.au
                                              OR    roo@mod.dsto.gov.au
Disclaimer: Opinions above are MINE, and probably worth what you paid for them.
Newsgroups: comp.os.msdos.programmer
From: dao@d62iggy.mitre.org (David A. Ondzes)
Subject: Help reading a DOS file
Reply-To: picasso@bass.bu.edu
Organization: The Mitre Corp., Bedford, MA.
Distribution: comp.os.msdos.programmer
Date: Wed, 22 Jul 1992 15:43:19 GMT


I need some help. One of my games writes it data to a file, and I would
like to read this file. When I type the file to the screen it shows up
as a bunch of happy faces etc ... so I am assuming it is a binary file.
Is this correct assumption ? I can make out some text in the file. I have
looked at the file with various hex edit programs to find out where the data
I want is.
 
	How do I read in the data ? I tried using fscanf(fd,"%x",&int). I would
like to be able to read in 2 hex digits at a time, because this is how I
saw the file with the hex editors mentioned above.

	Any help involing reading files that are not ascii text would also
be appreciated.


Please send replys to 
picasso@bass.bu.edu


Thank you
David Ondzes
From: wuth@castrov.cuc.ab.ca (Brett Wuth)
Newsgroups: comp.os.msdos.programmer
Subject: Wanted: Format of MS-DOS Backup tool
Date: 31 Jul 92 16:23:25 GMT

I'm looking for documentation, or an example program, that can read and
parse the floppy files created by MS-DOS's "backup" program.  I want to
create a tool that can handle the disks we get sent by our clients
in a little more convenient way than the standard "restore" does.

Any help or pointers appreciated.  Please e-mail.  I will post a summary
if requested.
-- 
Brett Wuth  wuth@castrov.cuc.ab.ca BCWuth@uncamult.bitnet wuth@castrov.UUCP
U302, 3510 44St SW, Calgary, Alberta, T3E 3R9, CANADA  Tel: +1 403 242-0848
From: jp07@gte.com (James Paschetto)
Newsgroups: comp.os.msdos.programmer
Subject: My trusted utilities stopped working!?! Help!
Date: 29 Jul 92 19:24:52 GMT
Organization: GTE Laboratories Incorporated, Waltham MA

I just re-configured my 386 from DOS 3.1 with a drive partitioned C: (5 megs)
and D: (150 megs) to DOS 4.01 with a single 155 meg partition.  This seemed
to go without a hitch, but now some of my old standby utilities can't find
existing data files.  For example, my old version of IBM's Personal Editor
(a basic text editor with some handy features) opens a *new* file when a
file with the same name is there in the current directory!

Has anyone else had problems of this sort?  Any suggestions as to what may
be happening?

Thanks for any help.
Jim
jp07@gte.com
Newsgroups: comp.os.msdos.programmer
From: sbhatia@mary.fordham.edu (SABU)
Subject: FILE LOCKING UNDER MS-DOS
Organization: Fordham University
News-Software: VAX/VMS VNEWS 1.41    
Date: Sun, 26 Jul 1992 06:19:00 GMT
X-Posted-From: mary.fordham.edu
X-Posted-Through: sol.ctr.columbia.edu

Hi,

    I have to implement a module for file locking under msdos. Firstly
the environment is dos 5.0 programming in "C" and compiling with 
Borland "C". 

    The objective is as follows-:

    If a user or a process is using a file no other process or user 
should be allowed access to a file. There are two cases I want to consider
the first one is in the case of networking if a process has placed
this lock no other process or user should be allowed access to this file
a message like "file currently locked by another user" should be
printed. However if the process that has placed this lock executes a
DOS shell and tries to access this file the same message should appear.

If the machine is not on the network then if the user has
placed a lock on a file and then executes a dos shell and tries to
access this file the user should be denied access and the appropriate
message should be printed.

Any help would be greatly appreciated.

Thanks,

sabu. 
////////////////////////////////////////////////////////////////////////
/   Internet:  SBHATIA@mary.fordham.edu                                /
/   BITnet:    SBHATIA@FORDMULC                                        /
/                                                                      /
/                                                                      /
////////////////////////////////////////////////////////////////////////
Newsgroups: comp.os.msdos.programmer
Subject: Please HLP me with help file formats
From: phys169@csc.canterbury.ac.nz
Date: 23 Jul 92 13:50:45 +1200
Organization: University of Canterbury, Christchurch, New Zealand

How do you create help files (.HLP) for MSDOS 5?  What format are they? (Are
they the same as, or at least compatible with, Windows 3.X help files?).  

There seem to be several programs that use help files with this same extension,
but I suspect they are incompatible. Ideally I'd like to create help files for
my programs that can be read by the same utility that reads system help files,
so users don't need to know where a utility came from to know how to find out
help about it.  Failing that, I'd like to create a help utility that can read
the main standard help file formats, so any information on file formats (even
text file style conventions) would be very helpful....

AdvTHANKSance,
Mark Aitchison, University of Canterbury.
Newsgroups: comp.os.msdos.programmer
From: ejajko@zeus.calpoly.edu (Edward Wladyslaw Jajko)
Subject: BC++ 3.0 bug? binary read still converts linefeed/cr
Organization: California Polytechnic State University, San Luis Obispo
Date: Sat, 25 Jul 1992 06:13:28 GMT

Recently, I've been deuling with my BC++ in an attempt to prevent it
from converting 0x0d+0x0a to \n internally. In all instances of my search,
I forced a binary open using the fopen() and have tried both fgetc() and
fwrite(); it still converts.
One final note: I am attempting to perform buffered I/O one character at
a time using setvbuf() in a string comparison routine.

Thanks-
	Edward W. Jajko
Newsgroups: comp.os.msdos.programmer,comp.os.msdos.misc,comp.lang.c
From: ankleand@mtl.mit.edu (Andrew Karanicolas)
Subject: Segmented Memory Architecture, DOS extenders, DJGPP
Organization: MIT Microsystems Technology Laboratories
Date: Tue, 28 Jul 1992 04:07:03 GMT

Hello,

Thanks for the e-mail replies concerning segmented memory architecture, DOS
extenders and djgpp.  Those who contributed were:

From COURTNEY@physci.uct.ac.za Thu Jul 23 09:19:14 1992
From jjmhome!alden!sgr@transfer.stratus.com Fri Jul 24 23:10:13 1992
From aronov@ziggy.poly.edu Sat Jul 25 18:12:09 1992
From brian@ganglion.Canada.Sun.COM Sun Jul 26 19:57:23 1992
From duperval@ERE.UMontreal.CA Mon Jul 27 09:24:09 1992
From <@mitvma.mit.edu:U20565@UICVM.BITNET> Tue Jul 21 22:22:28 1992
From rennolet@ai.cs.umn.edu Wed Jul 22 10:13:28 1992
From aki@cruzio.santa-cruz.ca.us Wed Jul 22 13:11:02 1992
From buers@DG1.CHEMIE.UNI-KONSTANZ.DE Thu Jul 23 09:58:49 1992
From mlevine@janis.astro.nwu.edu Thu Jul 23 10:30:10 1992
From kym@bingsuns.cc.binghamton.edu Thu Jul 23 12:21:40 1992
From anto@sol.acs.unt.edu Thu Jul 23 13:02:46 1992
From pshuang@Athena.MIT.EDU Thu Jul 23 17:58:33 1992
From poffen@sj.ate.slb.com Fri Jul 24 11:06:38 1992
From kenw@csn.org Fri Jul 24 10:05:45 1992

I down-loaded djgpp from an anonymous ftp site (barnacle.erc.clarkson.edu) 
and used it to compile and run my code.  We also decided to get Watcom C/386
ver. 9.01.  This was recently installed and was used to compile and
run my code.

For a commercial DOS extender, I checked Intel, Watcom and PharLap.
Watcom was the only one to offer educational discounts for an academic
institution.

If anyone wants to see the replies I got, send me e-mail and I will
send them in their entirety as one file.

-- 
Andrew Karanicolas
MIT Microsystems Technology Laboratory
ankleand@mtl.mit.edu
From: gmt@reef.cis.ufl.edu (GMM)
Newsgroups: comp.os.msdos.programmer
Subject: Re: BC++ syntax highlighting????
Date: 27 Jul 92 12:41:48 GMT
Organization: Univ. of Florida CIS Dept.


>As far as I know, versions 6.0 and 7.0 of Microsoft C do NOT have this
>highlighting.

FYI, Microsoft's QuickPascal does this type of highlighting.
Newsgroups: comp.os.msdos.programmer
Subject: Re: Reboot from protected mode
From: billp@jupiter.cse.utoledo.edu (bill parquet)
Date: 29 Jul 92 22:13:22 EST

sankey@unixg.ubc.ca (Todd Sankey) writes:
:  Does anyone have a description or code snippet or anything to
: describe how to reboot the PC from protected mode?

Rebooting and kicking the computer out of protected mode are pretty similar.

To reboot just do:  mov   al,0feh
		    out   64h, al

(It seems to be 100% effective on my 286, but it sometimes causes my 486
to crash).  To get out of protected mode, there's a few outs to the CMOS
before the big fe->64 to kind of give the bios a resume command.  I don't
know what they are off the top of my head.  (BTW  You might want to 
HLT, jump back to the halt after that... It seems like overkill, but the
BIOS does it!)  
Newsgroups: comp.os.msdos.programmer