TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: All
from: Paul Wankadia
date: 1996-09-29 09:13:24
subject: Auto string-length determination

My input routine requires that the programmer pass (as a parameter) the

maximum length of the string :



int Get_Input(char *, int, Idle_Ptr = Idle, int = 0, char * = "\x00");

                      ~~~

        /* hi-tech input function :)

                parameters are : 1 - string-input variable

                                 2 - maximum length

                                 3 - pointer to idle function

                                 4 - echo characters on/off

                                 5 - characters to exclude

                returns : 1 - if input aborted

                          0 - if input finished normally

        */



after they have declared the variable with a certain length (e.g. like this :



char String[100] = "";



I tried to automatically determine the maximum string length by using :



int Max_Length = sizeof(String) / sizeof(char);



because it is an array of char.  What am I doing wrong?



Chow.



Junyer Hakker.



--- PPoint 2.00

* Origin: Junyer's Workshop (3:640/772.3)
SEEN-BY: 50/99 620/243 623/630 640/201 206 216 217 222 230 238 254 297 305
SEEN-BY: 640/309 370 375 386 531 535 547 739 750 772 773 820 821 822 823 890
SEEN-BY: 640/895 937 711/401 409 410 413 430 808 809 932 934 712/515 713/888
SEEN-BY: 714/906 800/1
@PATH: 640/772 531 201 820 711/409 808 934

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