Path: utzoo!attcan!uunet!samsung!usc!wuarchive!decwrl!shelby!portia!gaia From: gaia@portia.Stanford.EDU (fai to leung) Newsgroups: comp.sys.ibm.pc Subject: Re: Various Turbo pascal questions Keywords: Turbo pascal Message-ID: <6983@portia.Stanford.EDU> Date: 25 Nov 89 08:35:13 GMT References: <2185@leah.Albany.Edu> <6972@portia.Stanford.EDU> <4269@pegasus.ATT.COM> Sender: fai to leung Reply-To: gaia@portia.Stanford.EDU (fai to leung) Organization: Stanford University Lines: 41 In article <4269@pegasus.ATT.COM> psrc@pegasus.ATT.COM (Paul S. R. Chisholm) writes: >> In article <2185@leah.Albany.Edu> ppd491@leah.Albany.Edu (Peter P. Donohue) writes: >> 1) In an external data file (containing all ascii data), what is the >> maximum length of a line allowed? > >In article <1989Nov23.183325.4549@uwasa.fi>, ts@uwasa.fi (Timo Salmi LASK) writes: >> If you use ordinary strings the maximum is only 255 characters. >> You can make it as long as 64K allows by adapting >> var line : array [maxlengt] of char; >> There are some good "LongString" routines in O'Brien, Turbo Pascal, >> the Complete Reference. > >In article <6972@portia.Stanford.EDU>, gaia@portia.Stanford.EDU (fai to leung) writes: >> I would say 255 characters long. >> Pascal strings format are byte[0]=length of string follow by the ascii chars. > >Yes, if you try to read the whole line in at once. If you read() each >character one at a time, and don't need the whole line in memory at the >same time, is there a limit? (I would hope not, but TP might do some >internal buffering.) Peter, you might try this yourself. Of course any file can be assessed in a byte stream style. A text in TP is a special file. A simple type of TYPE BIGGGGG_STRING = record size:ORD_TYPE; DATA:Maxsize_can_handle; end; will give a good size "string", (>=64K?) and you don't byte read, but assign(file_type,name_string_of_file); reset(file_type,sizeof(BIGGGGG_STRING)); then read it in by blockread(file_type,BIGGGGG_STRING_buffer,1); or the whole thing changing "1". so much for TP