TIP: Click on subject to list as thread! ANSI
echo: pascal
to: ALL
from: KOBA TSVENIASHVILY
date: 1998-04-06 19:42:00
subject: copy , plz help

  Hi every1. Whats up?
I need to make a copy program so I wrote below code.
I compile it in HUGE memory model.
The problem occurs when the buffer size is over 60000 bytes.
Does fread or fwrite have some limitations?  Plz help.
Plz Plz Plz help.
#include
#include
#include
void copy()
{
unsigned long buf_num,fsize=1212409;  /* change fsize to your file size */
char *buf;
FILE *in,*out;
in=fopen("tc30.arj","rb");   /* change tc30.arj to some of your files */
out=fopen("test.arj","wb");  /* output file */
buf_num=coreleft();   /* If memory left is bellow 60000 it will work! */
if(buf_num>fsize) buf_num=fsize;
buf=(char*)malloc(buf_num);
while(fsize)
{
  fread(buf,buf_num,1,in);
  fwrite(buf,buf_num,1,out);
  fsize-=buf_num;
  if(fsize)
    if(buf_num>fsize) buf_num=fsize;
 }
free(buf);
fcloseall();
}
... Backup not found: (A)bort (R)etry (S)lap nearest innocent bystander.
---
 [ Quoting Bas Verdult to Scott Little ]
 BV> but remains the question 'what exactly is consuming more space'.
The heirarchy structure most likely - and the fact that each level is it's
own entity can't be easy to do.
-- Scott Little, 3:712/848@fidonet ; slittle@fairfax.com.au
                                     www.asstdc.com.au/~cyberia
   NOTE: admin@cyberia.asstdc.com.au is temporarily offline.
--- FMail/Win32 1.22+
---------------
* Origin: þ Fire Storm BBS þ +972-3-5368921 þ 22:00-8:00 þ 33k þ (2:403/202)
* Origin: Cyberia: You know you want it. [02-9534-1702] (3:712/848)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.