public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* filesize function
@ 1999-07-10  7:33 Reza Habib
  1999-07-11 12:31 ` Mumit Khan
  1999-07-31 18:34 ` Reza Habib
  0 siblings, 2 replies; 4+ messages in thread
From: Reza Habib @ 1999-07-10  7:33 UTC (permalink / raw)
  To: Cygwin Mailing List

Hi.  I'm using the filesize function from io.h on mingw32 with egcs 1.1.2.
The size reported by the function is incorrect.  The exact same line reports
the correct value with either visual c++ or borland c++.  Is this a bug in
the mingw32 library?  Here is the line:

FILE *datamatfile = fopen(argv[1],"rb");
long length = filelength(fileno(datamatfile));

Thanks.

Reza


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: filesize function
  1999-07-10  7:33 filesize function Reza Habib
@ 1999-07-11 12:31 ` Mumit Khan
  1999-07-31 18:34   ` Mumit Khan
  1999-07-31 18:34 ` Reza Habib
  1 sibling, 1 reply; 4+ messages in thread
From: Mumit Khan @ 1999-07-11 12:31 UTC (permalink / raw)
  To: Reza Habib; +Cc: Cygwin Mailing List

On Sat, 10 Jul 1999, Reza Habib wrote:

> Hi.  I'm using the filesize function from io.h on mingw32 with egcs 1.1.2.
> The size reported by the function is incorrect.  The exact same line reports
> the correct value with either visual c++ or borland c++.  Is this a bug in
> the mingw32 library?  Here is the line:
> 
> FILE *datamatfile = fopen(argv[1],"rb");
> long length = filelength(fileno(datamatfile));
> 

Sorry, but a line doesn't tell me anything at all about the rest of your
code.

I tried out the following program and it gives me the same result as MSVC
and what-not. If you can provide a complete testcase showing the problem,
I'll look at it. 
  
  $ gcc -g -Wall -o file-length-test.exe file-length-test.c
  $ file-length-test file-length-test.c

and see what size you get.

== cut from here to end.
#include <io.h>
#include <stdio.h>
#include <stdlib.h>

int
main (int argc, char *argv[])
{
  const char *fname = (argc == 2) ? argv[1] : NULL;
  FILE *fp;
  long fsize;

  if (fname == NULL)
    {
      fprintf (stderr, "Usage: %s filename\n", argv[0]);
      exit (1);
    }
  
  fp = fopen (fname, "rb");
  if (fp == NULL)
    {
      perror (fname);
      exit (1);
    }
  
  fsize = filelength (fileno (fp));
  printf ("%s: size = %ld\n", fname, fsize);
  fclose (fp);

  exit (0);
}



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: filesize function
  1999-07-11 12:31 ` Mumit Khan
@ 1999-07-31 18:34   ` Mumit Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Mumit Khan @ 1999-07-31 18:34 UTC (permalink / raw)
  To: Reza Habib; +Cc: Cygwin Mailing List

On Sat, 10 Jul 1999, Reza Habib wrote:

> Hi.  I'm using the filesize function from io.h on mingw32 with egcs 1.1.2.
> The size reported by the function is incorrect.  The exact same line reports
> the correct value with either visual c++ or borland c++.  Is this a bug in
> the mingw32 library?  Here is the line:
> 
> FILE *datamatfile = fopen(argv[1],"rb");
> long length = filelength(fileno(datamatfile));
> 

Sorry, but a line doesn't tell me anything at all about the rest of your
code.

I tried out the following program and it gives me the same result as MSVC
and what-not. If you can provide a complete testcase showing the problem,
I'll look at it. 
  
  $ gcc -g -Wall -o file-length-test.exe file-length-test.c
  $ file-length-test file-length-test.c

and see what size you get.

== cut from here to end.
#include <io.h>
#include <stdio.h>
#include <stdlib.h>

int
main (int argc, char *argv[])
{
  const char *fname = (argc == 2) ? argv[1] : NULL;
  FILE *fp;
  long fsize;

  if (fname == NULL)
    {
      fprintf (stderr, "Usage: %s filename\n", argv[0]);
      exit (1);
    }
  
  fp = fopen (fname, "rb");
  if (fp == NULL)
    {
      perror (fname);
      exit (1);
    }
  
  fsize = filelength (fileno (fp));
  printf ("%s: size = %ld\n", fname, fsize);
  fclose (fp);

  exit (0);
}



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* filesize function
  1999-07-10  7:33 filesize function Reza Habib
  1999-07-11 12:31 ` Mumit Khan
@ 1999-07-31 18:34 ` Reza Habib
  1 sibling, 0 replies; 4+ messages in thread
From: Reza Habib @ 1999-07-31 18:34 UTC (permalink / raw)
  To: Cygwin Mailing List

Hi.  I'm using the filesize function from io.h on mingw32 with egcs 1.1.2.
The size reported by the function is incorrect.  The exact same line reports
the correct value with either visual c++ or borland c++.  Is this a bug in
the mingw32 library?  Here is the line:

FILE *datamatfile = fopen(argv[1],"rb");
long length = filelength(fileno(datamatfile));

Thanks.

Reza


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-07-31 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-10  7:33 filesize function Reza Habib
1999-07-11 12:31 ` Mumit Khan
1999-07-31 18:34   ` Mumit Khan
1999-07-31 18:34 ` Reza Habib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).