| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Auto string-length deter |
On 19 Oct 96, Adam Fitzpatrick wrote to Paul Wankadia -- AF> PW>What would I have to do? Use strdup() to duplicate the string AF> locally PW>and then sizeof() that duplicate string perhaps??? AF> since strdup returns a char*, it would have the same result - and the Yup. You're a little behind the times, Adam :) AF> allocated memory would be strlen(String)+1 (ie, the amount of memory AF> required by whatever string was stored in String at the time), not 100 AF> (the actual size of the array). Uh huh... I've decided to stay with passing the maximum length to the function. Thanks :) AF> FA>So sizeof() will return the length of the pointer. AF> PW>I seem to get 2... AF> I presume you're using DOS with the small memory model then. A two AF> byte pointer is a near pointer, giving you up to 64k to address. Yep. SMALL model it is... AF> PW>BTW how can I make a pointer to point to a set place in memory AF> (i.e. PW>segment and offset) ??? AF> You'd need a far pointer. To make far char *st point to 1234:5678, AF> you'd use st=(far char*)0x12345678. (I haven't needed to do this for a AF> while, so my memory's a little hazy; it might be char far*). I think it's "char far *"... AF> Your compiler may also provide a function or macro to do this more AF> neatly - have a look in dos.h. Yep. Borland seems to have MK_FP and stuff like that. Thanks, Borland :) AF> ... MicroSloth: "Bringing you ten-year-old technology, tomorrow, maybe." ... MicroScum : How many times do you want to crash your computer today? Chow. Junyer Hakker. --- PPoint 2.00* Origin: Junyer's Workshop (3:640/772.3) SEEN-BY: 633/267 270 @PATH: 640/772 531 201 820 711/409 808 50/99 635/728 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™.