delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/16/15:50:46

From: "Ya'qub" <rick AT nct-active DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Strange behaviour
Date: Tue, 16 Mar 1999 16:00:48 -0000
Lines: 36
X-Newsreader: Microsoft Outlook Express 4.72.3115.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
NNTP-Posting-Host: 193.123.236.199
Message-ID: <36ee7e34.0@nnrp1.news.uk.psi.net>
X-Trace: 16 Mar 1999 15:52:20 GMT, 193.123.236.199
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Greetings,
    Sorry for posting this again but the first post didn't get any reply :(
Can anyone please compile and run the following short program and tell me if
they can get it to work.
----------------------
#include <stdio.h>
int main()
{
    FILE* infid;
    FILE* outfid;

    short val;

    infid = fopen("output.dat","r");
    outfid = fopen("result","w");

    while (fscanf(infid,"%hX",&val) == 1)
        fprintf(outfid,"%.10f\n",(float)val/32768.0);

    fclose(infid);
    fclose(outfid);

    return 0;
}
--------------------------------------------------------
The file output.dat contains numbers in hex, one per line e.g.
0x1234
0xF234
0x5678

Whenever I run the program, the 'result' file is always empty. However, the
same program runs fine when compiled and run from MSVC. Any ideas? Thanks.
Ya'qub



- Raw text -


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