TIP: Click on subject to list as thread! ANSI
echo: net_dev
to: mark lewis
from: Tom Torfs
date: 1998-06-02 10:26:00
subject: (1/2) PKT2000 revisio

mark lewis wrote in a message to Joe Martin:

 ml> they are limited to 64k... TP/BP 7.0's PChar, Delphi's stuff and
 ml> C... all are nul terminated character arrays and their max length
 ml> is 64k... 

I also doubt the others, but I'm *very* sure about C strings... they have
no such limit at all, except maybe on some operating systems in some memory
models.

Here's a small test program allocating a one million byte string (999999
characters + 1 terminating nul byte):

#include 
#include 
#include 
#include 

int main(void)
{
   char *str = malloc(1000000);
   assert(str);

   memset(str,'x',999999);
   str[999999] = '\0';

   printf("string length = %d\n", strlen(str));

   return 0;
}


Here's the compilation:

WATCOM C/C++32 Compile and Link Utility Version 10.6
Copyright by WATCOM International Corp. 1988, 1996. All rights reserved.
WATCOM is a trademark of WATCOM International Corp.
       wcc386 strtest.c 
WATCOM C32 Optimizing Compiler  Version 10.6 
Copyright by WATCOM International Corp. 1984, 1996. All rights reserved.
WATCOM is a trademark of WATCOM International Corp.
strtest.c: 16 lines, included 834, 0 warnings, 0 errors

Code size: 102

WATCOM Linker Version 10.6
Copyright by WATCOM International Corp. 1985, 1996. All rights reserved.
WATCOM is a trademark of WATCOM International Corp.
loading object files
searching libraries
creating an OS/2 32-bit executable

And here's the output:

string length = 999999

greetings,
Tom
tomtorfs{at}village.uunet.be

--- timEd/2 1.10+
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)
SEEN-BY: 20/10 200/0 201/0 100 200 209 300 400 407 411 505 600 204/450 205/0
SEEN-BY: 206/0 270/101 490/21 633/267 270
@PATH: 292/516 506 854 396/1 270/101 201/505 633/267

SOURCE: echomail via fidonet.ozzmosis.com

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™.