TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Wankadia
from: Paul Edwards
date: 1996-10-06 14:33:50
subject: Auto string-length deter

FA> So sizeof() will return the length of the pointer.

PW> I seem to get 2...

In small memory model you will get that.  Try compiling in large, and you'll get 4.

PW> BTW how can I make a pointer to point to a set place in memory (i.e. 
PW> segment and offset) ???

Borland provide a MK_FP macro.

FA> Perhaps if the string is global it may also work, but i didn't try or
FA> even said that !.:)

PW> What's wrong with global variables? :)

Nothing more than global functions.

FA> 2 or 4 bytes (i forget) back from the pointer and you'll find the
FA> alloced block size somewhere, it only seems to work with the Borland
FA> RTL..

PW> What's RTL?  

Run Time Library.

PW> BTW I'd rather keep the code as portable as possible (between

Good to see.  You should have a bloody good reason not to make it portable,
rather than the other way around.  And isolate out the non-portable bits,
either into separate source files, or at least put a #ifdef around it (and
make the #ifdef the non-default, and make it still do *something* on an
ISO-only environment).  BFN.  Paul. 
@EOT:

---
* Origin: X (3:711/934.9)

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