delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/07/11/14:08:55

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200107111714.TAA05783@father.ludd.luth.se>
Subject: Re: DJDIR Windows 2000 investigation results #1
In-Reply-To: <8011-Wed11Jul2001190244+0300-eliz@is.elta.co.il> from Eli Zaretskii at "Jul 11, 2001 07:02:45 pm"
To: djgpp-workers AT delorie DOT com
Date: Wed, 11 Jul 2001 19:14:29 +0200 (MET DST)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

According to Eli Zaretskii:
> > From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
> > The src/libc/dos/io/_*.c files seem to be inconsistent as some check the
> > _osmajor version number if LFN is used and some don't.
> 
> Hmm... that's true.  Martin, do you remember why _open and _creatnew,
> for example, use a different logic as far as OS versions are
> concerned?

I think the thinking was LFNs supported -> FAT32 supported. Thus the code.

> > Do you have any sample apps for me to try?
> 
> Martin, perhaps you could send your test program to Andrew?

I'm having problems finding them, but here's one:

#include <unistd.h>
#include <stdio.h>
#include <limits.h>
#include <fcntl.h>
#include <sys/stat.h>

int main(int argc, char *argv[])
{
  char ch = 'G';
  int fd;
  long long new_size;
  long long ret;

  if( argc != 2
   || sscanf(argv[1], "%lld", &new_size) != 1
      )
  {
    fprintf(stderr, "%s: run like this '%s <size_to_write>'.\n",
            argv[0], argv[0]
            );
    exit(1);
  }

  printf("Seeking to %lld.\n", new_size);

  fd = open("f:/ggg.hmm", O_RDWR|O_CREAT, S_IWUSR);
  if( 0 <= fd )
  {
    printf("fd = %d.\n", fd);

    llseek(fd, new_size, SEEK_SET);
    ret = write(fd, &ch, 1);
    printf("1: ret = %lld.\n", ret);

    close(fd);

  }
  else
  {
    perror("Ouch");
  }

  return(0);
}


Right,

						MartinS

- Raw text -


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