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