www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/20/17:38:53

Xref: news2.mv.net comp.os.msdos.djgpp:4052
From: Juanjo Erauskin <juanjo AT jet DOT es>
Newsgroups: comp.os.msdos.djgpp
Subject: maximum open files for program
Date: Mon, 20 May 1996 16:40:31 +0200
Organization: Servicio IBERNET (Telefonica Transmision de Datos)
Lines: 43
Message-ID: <31A0845F.92C@jet.es>
NNTP-Posting-Host: info173.jet.es
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello:
	I have problems with maximum open files for program, and i write 
this program:

/* begin of file foo.c */

#include <stdio.h>
#include <stdlib.h>
main(int argc,char **argv)
{
  int i = 0;
  FILE *fd;
  char filename[12], filenamebase[12];
  char *f;
  
  /* Keep opening files until fopen fails */
  for(i=0;i<16;i++) {
	printf("file:%d\n",i);
      /* Overcome this mktemp()'s limit of 26 files with one template */
      if(i%26 == 0)
        {
          sprintf(filenamebase, "%d", i/26);
          strcat(filenamebase, "XXXXXX");
        }
      strcpy(filename, filenamebase);
      f = mktemp(filename);
      fd = fopen(f, "w");
	  if(fd==(FILE *)NULL) {
			printf("Error in %d file number\n",i);
			exit(0);
	  }
    }
	system("foo");
}

/* End of file */

	When the program call system() function, return this error: 	
foo.exe: cannot open

	The FILES and FCBS values are set to 200 and 100 respectively. 
What is happen?. Thanks
			juanjo AT jet DOT es

- Raw text -


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