www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/20/06:40:26

From: =?windows-1250?Q?Ladislav_Dvo=F8=E1k?= <dvorakl AT jednotacb DOT cz>
To: <djgpp AT delorie DOT com>
Subject: Re: crashed when float = int / 2
Date: Tue, 20 Nov 2001 10:20:38 +0100
Message-ID: <NEBBLBIDCLEEIPODBKHIMEPPCCAA.dvorakl@jednotacb.cz>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2469.0002
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C171AD.00252600
Content-Type: text/plain;
	charset="windows-1250"
Content-Transfer-Encoding: 7bit

I show crash dump. And there is Coprocessor not available.... I showed
complete dump list as many as now. Previously I showed only latest line
(display is too small). I enable floating-point emulation and I think, that
is a solution.
Thank you, for your help
Lada Dvorak

"Hans-Bernhard Broeker" < broeker AT physik DOT rwth-aachen DOT de
<mailto:broeker AT physik DOT rwth-aachen DOT de> > wrote in message
news:9tbb2t$i06$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE...
> Ladislav Dvo??k < dvorakl AT jednotacb DOT cz <mailto:dvorakl AT jednotacb DOT cz> >
wrote:
> > Hi,
> > I have a application. When I run this application in Windows 95 or in
DOS
> > (with cwsdpmi.exe), he works without problem. When I this application
run on
> > barcode scanner Falcon 330 with ROM-DOS 6.22 and AMD Elan AM486
processor I
> > have this problem.
>
> > long vyhledzbo(char ean[20])
> > {
> > FILE *ciselnik;
> > int vpom,pozmez,prv,pzaznamu,pruchodu=18;
> > long kurszmm,kurszm,vpozice;
> > char cean[20];
> > float krok;
> > int delkavety = 102;
> > ciselnik = fopen("expean.txt","r");
> > fseek (ciselnik,-delkavety,SEEK_END);
>
> I suspect the error happens here, already.  Note that you opened the
> file in text mode, and then used fseek in SEEK_END mode on it, with a
> nonzero offset. That's not guaranteed to do anything useful at all.
>
> It'd probably be better if you opened that file in binary mode.
>
> > pzaznamu = (ftell(ciselnik) / delkavety) + 1;
> > krok = pzaznamu / 2;
>
> > On line >krok=pzaznamu /2;< program crashed.
>
> How exactly did it crash, and how certain are you that it was *this*
> particular line?  If you have a crash dump, please show it.
>
> My guess would be that it's not this line, but the one above it that's
> going wrong.  Int->float conversion should always be safe, whereas the
> conversion from long to int involved in your calculation of pzaznamu
> may or may not.
>
> BTW: you *did* #include <stdio.h> somewhere before this snippet, I hope?
> --
> Hans-Bernhard Broeker ( broeker AT physik DOT rwth-aachen DOT de
<mailto:broeker AT physik DOT rwth-aachen DOT de> )
> Even if all the snow were burnt, ashes would remain.

------=_NextPart_000_0000_01C171AD.00252600
Content-Type: text/html;
	charset="windows-1250"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1250">
<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 9">
<meta name=3DOriginator content=3D"Microsoft Word 9">
<link rel=3DFile-List href=3D"cid:filelist DOT xml AT 01C171AC DOT FE70BF40">
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:HyphenationZone>21</w:HyphenationZone>
  <w:EnvelopeVis/>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
	{margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
span.StylZprvyElektronickPoty15
	{mso-style-type:personal-compose;
	mso-ansi-font-size:10.0pt;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:black;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
</head>

<body lang=3DCS link=3Dblue vlink=3Dpurple =
style=3D'tab-interval:35.4pt'>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D3 color=3Dblack face=3D"Times New =
Roman"><span
style=3D'font-size:12.0pt;color:black'>I show crash dump. And there is
Coprocessor not available.... I showed<br>
complete dump list as many as now. Previously I showed only latest =
line<br>
(display is too small). I enable floating-point emulation and I think, =
that<br>
is a solution.<br>
Thank you, for your help<br>
Lada Dvorak<br>
<br>
&quot;Hans-Bernhard Broeker&quot; &lt;<a
href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de">broeker AT physik DOT rwth-aachen.=
de</a>&gt;
wrote in message<br>
<a =
href=3D"news:9tbb2t$i06$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE">news:9tbb2t$i06$1 AT nets=
3.rz.RWTH-Aachen.DE</a>...<br>
&gt; Ladislav Dvo??k &lt;<a =
href=3D"mailto:dvorakl AT jednotacb DOT cz">dvorakl AT jednotacb DOT cz</a>&gt;
wrote:<br>
&gt; &gt; Hi,<br>
&gt; &gt; I have a application. When I run this application in Windows =
95 or in<br>
DOS<br>
&gt; &gt; (with cwsdpmi.exe), he works without problem. When I this =
application<br>
run on<br>
&gt; &gt; barcode scanner Falcon 330 with ROM-DOS 6.22 and AMD Elan =
AM486<br>
processor I<br>
&gt; &gt; have this problem.<br>
&gt;<br>
&gt; &gt; long vyhledzbo(char ean[20])<br>
&gt; &gt; {<br>
&gt; &gt; FILE *ciselnik;<br>
&gt; &gt; int vpom,pozmez,prv,pzaznamu,pruchodu=3D18;<br>
&gt; &gt; long kurszmm,kurszm,vpozice;<br>
&gt; &gt; char cean[20];<br>
&gt; &gt; float krok;<br>
&gt; &gt; int delkavety =3D 102;<br>
&gt; &gt; ciselnik =3D fopen(&quot;expean.txt&quot;,&quot;r&quot;);<br>
&gt; &gt; fseek (ciselnik,-delkavety,SEEK_END);<br>
&gt;<br>
&gt; I suspect the error happens here, already.&nbsp; Note that you =
opened the<br>
&gt; file in text mode, and then used fseek in SEEK_END mode on it, with =
a<br>
&gt; nonzero offset. That's not guaranteed to do anything useful at =
all.<br>
&gt;<br>
&gt; It'd probably be better if you opened that file in binary mode.<br>
&gt;<br>
&gt; &gt; pzaznamu =3D (ftell(ciselnik) / delkavety) + 1;<br>
&gt; &gt; krok =3D pzaznamu / 2;<br>
&gt;<br>
&gt; &gt; On line &gt;krok=3Dpzaznamu /2;&lt; program crashed.<br>
&gt;<br>
&gt; How exactly did it crash, and how certain are you that it was =
*this*<br>
&gt; particular line?&nbsp; If you have a crash dump, please show =
it.<br>
&gt;<br>
&gt; My guess would be that it's not this line, but the one above it =
that's<br>
&gt; going wrong.&nbsp; Int-&gt;float conversion should always be safe, =
whereas
the<br>
&gt; conversion from long to int involved in your calculation of =
pzaznamu<br>
&gt; may or may not.<br>
&gt;<br>
&gt; BTW: you *did* #include &lt;stdio.h&gt; somewhere before this =
snippet, I
hope?<br>
&gt; --<br>
&gt; Hans-Bernhard Broeker (<a =
href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de">broeker AT physik DOT rwth-aachen.=
de</a>)<br>
&gt; Even if all the snow were burnt, ashes would =
remain.</span></font><span
class=3DStylZprvyElektronickPoty15><font size=3D2 color=3Dblack =
face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><o=
:p></o:p></span></font></span></p>

</div>

</body>

</html>

------=_NextPart_000_0000_01C171AD.00252600--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019