255 Character Limit with FREADLINE 
Author Message
 255 Character Limit with FREADLINE

Has anyone else experience this problem.

I am building a program at work which needs to be able to read an INI style
file, there is one line which
is 280 characters.  And when I use the following:

  cLineIn := freadline(nFileIn)

It only reads in 255 characters.  Even if I do:

  cLineIn := freadline(nInFile,512)

I looked at my compile batch, which included this line:

  SEARCH FUNBLINK  // WHAT DOES THIS DO????

Which is Blinker, but am not sure what it does...

Also, if I do this:

  cLineIn := freadline(nInFile)

  ? len(cLineIn)   // This displays 255 characters

  cLineIn := freadline(nInFile)

  ? len(cLineIn) // This displays 25 characters, it's like the buffer is
being changed or something, what gives???

Thanks in advance...



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
Are you sure that freadline is a pure clipper function ?

I know that fread is.  And with it, you specify the size of the buffer.

However freadline is implemented, it may have a limitation.

I can send my favorite text reading piece of code if needed.

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE

Quote:
> Has anyone else experience this problem.

> I am building a program at work which needs to be able to read an INI
> style file, there is one line which is 280 characters. And when I use the
> following:

>   cLineIn := freadline(nFileIn)

> It only reads in 255 characters.  Even if I do:

>   cLineIn := freadline(nInFile,512)

Where does this freadline() function come from? It isn't part of CA-Clipper.
If you need a line reading function that works I can post one (I would have
posted a Deja <URL:http://www.deja.com/usenet/> pointer to a previous
posting that contained it but they've expired it now, <grrr>).

BTW, The Oasis <URL:http://www.the-oasis.net/> contains at least one INI
file reading/writing library that I'm aware of.

--
Take a look in Hagbard's World: |   w3ng - The WWW Norton Guide reader.
http://www.hagbard.demon.co.uk/ |     eg - Norton Guide reader for Linux.
http://www.acemake.com/hagbard/ |    weg - Norton Guide reader for Windows.
Free software, including........| dgscan - DGROUP scanner for Clipper.



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
Michael

Show us the code for FREADLINE(), it's probably set up to only read in 255
characters by default.

Quote:
>   SEARCH FUNBLINK  // WHAT DOES THIS DO????

Command that tells your linker to 'Search a library called FUNBLINK'<g>

Quote:
> Which is Blinker, but am not sure what it does...

Are you sure, I don't have this library in any of my Blinker installs V3-V5.

If your reading ini files have a look at the 'inifile' stuff on the OASIS.

--
HTH
Steve Quinn
The only cure for insomnia is to get more sleep.
Everybody lies, but it doesn't matter since nobody listens.
I wished the buck stopped here, as I could use a few.



Quote:
> Has anyone else experience this problem.

> I am building a program at work which needs to be able to read an INI
style
> file, there is one line which
> is 280 characters.  And when I use the following:

>   cLineIn := freadline(nFileIn)

> It only reads in 255 characters.  Even if I do:

>   cLineIn := freadline(nInFile,512)

> I looked at my compile batch, which included this line:

>   SEARCH FUNBLINK  // WHAT DOES THIS DO????

> Which is Blinker, but am not sure what it does...

> Also, if I do this:

>   cLineIn := freadline(nInFile)

>   ? len(cLineIn)   // This displays 255 characters

>   cLineIn := freadline(nInFile)

>   ? len(cLineIn) // This displays 25 characters, it's like the buffer is
> being changed or something, what gives???

> Thanks in advance...



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
On Wed, 26 Jul 2000 01:38:44 GMT, "Michael J. Gregg"

Quote:

>Has anyone else experience this problem.

>I am building a program at work which needs to be able to read an INI style
>file, there is one line which
>is 280 characters.  And when I use the following:

>  cLineIn := freadline(nFileIn)

>It only reads in 255 characters.  Even if I do:

>  cLineIn := freadline(nInFile,512)

>I looked at my compile batch, which included this line:

>  SEARCH FUNBLINK  // WHAT DOES THIS DO????

>Which is Blinker, but am not sure what it does...

>Also, if I do this:

>  cLineIn := freadline(nInFile)

>  ? len(cLineIn)   // This displays 255 characters

>  cLineIn := freadline(nInFile)

>  ? len(cLineIn) // This displays 25 characters, it's like the buffer is
>being changed or something, what gives???

>Thanks in advance...

Hello Michael,

FReadLine() is a function of the Funcky library...one of its
components is FUNBLINK (if I remember correctly). Nothing to do with
Blinker....I think. disclaimers aplenty...

The length of the Funcky version buffer defaults to 512, so I suggest
you look at your source code to see if you have a FLineLen(255) which
is defining the limit you are experiencing. The practical limit of
this function is 2048 characters.

Love that Funcky.....

Regards,

Ross McKenzie
ValuSoft
(affordable source recovery available)
(Fix1900 utility available)
(custom hardware interfaces)
www.irvis.nl



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
On Wed, 26 Jul 2000 18:21:19 +1000, "Stephen Quinn"

Quote:

>Michael

snip

Quote:

>If your reading ini files have a look at the 'inifile' stuff on the OASIS.

In which case I should post the corrections (minor as they are) that
are needed to make Peter Townsend's INIFILE.ZIP product work
correctly.

Regards,

Ross McKenzie
ValuSoft
(affordable source recovery available)
(Fix1900 utility available)
(custom hardware interfaces)
www.irvis.nl



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
Funcky function

You should use fLineLen(nNewLen) to set the maximum length of the buffer.
Anyway nNewLen cannot exceed 2048 bytes including CR/LF



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE


Quote:
>The length of the Funcky version buffer defaults to 512, so I suggest
>you look at your source code to see if you have a FLineLen(255) which
>is defining the limit you are experiencing. The practical limit of
>this function is 2048 characters.

>Love that Funcky.....

Then my parsing routine exceed that of Funcky since the limit now
about 64K ;-)
Have a look at the attached. Sorry for posting binary.

--
Andi Jahja <andij at aonlippo dot co dot id>



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE


Quote:
>The length of the Funcky version buffer defaults to 512, so I suggest
>you look at your source code to see if you have a FLineLen(255) which
>is defining the limit you are experiencing. The practical limit of
>this function is 2048 characters.

>Love that Funcky.....

Then my parsing routine exceed that of Funcky since the limit now
about 64K ;-)

Here goes the code:

#define IF_BUFFER 65516
#include "fileio.ch"
static inifile := {{},{},{},{}}

*************
function test

local cini := "test.ini"
local citem

citem := iniget(cini,"section 1","item",repl("abc",2000))
? len( citem )
inisave( cini )

return nil

*************
function iniload( cfile )

local cline
local aini     := {}
local acomment := {}
local cini     := ""
local nlast    := 0
local nhandle, npos, nat
local cleft, ny, ni
local bini     := { || if ( nlast == 0,aadd( acomment, cini ),(aadd(
aini[nlast][2], ";" ),aadd( aini[nlast][3], subs( cini, 2 ) ))) }
local _13      := chr(13)
local nparser

if empty(inifile[3])
   inifile[3] := {"C","D","N","L"}
   inifile[4] :=
{{|x|x},{|x|dtoc(x)},{|x|ltrim(str(x))},{|x|if(x,"yes","no")}}
endif

if ( npos := iniisloaded( cfile ) ) == 0
   if ( nhandle := fopen( cfile ) ) == - 1
      nhandle := fcreate( cfile )
   endif
   cline := space( IF_BUFFER  )

      while ( ni := at( _13,  cline ) ) > 0
         cini    := alltrim(left(cline, ni - 1))
         cline   := substr( cline, ni + 1 )
         cleft   := left(cini,1)
         nparser := at("=",cini)
         if cleft == "[" .and. (ny := at(']', cini)) > 0
            aadd( aini, { alltrim( subs( cini, 2, ny - 2 ) ), {}, {} }
)
            nlast := len( aini )
         elseif cleft == ";"
            eval( bini )
         elseif nparser > 0
            if nlast > 0
               aadd( aini[nlast][2], left(cini,nparser-1) )
               aadd( aini[nlast][3], substr(cini,nparser+1) )
            endif
         endif
      enddo
      cLine := space(IF_BUFFER)

   enddo
   fclose( nhandle )
   aadd( inifile[1], cfile )
   aadd( inifile[2], { acomment, aini } )
else
   aini := inifile[2][npos]
endif
return aini

*************
function iniunload( cfile )

local npos, lret := .f.
if ( npos := iniisloaded( cfile ) ) > 0
   aeval( inifile, { |e| e:deleteat( npos ) }, 1, 2 )
   lret := .t.
endif
return lret

*************
function iniisloaded( cfile )
return ascan( inifile[1], { |e| upper(e) == upper( cfile ) } )

*************
function iniget( cfile, csection, citem, cdefault, cvalue )

local npos, nitem, cretval := "", aini := {}

aini := if( ( npos := iniisloaded( cfile ) ) > 0,;
   inifile[2][npos][2],;
   iniload( cfile )    )

if ( npos := ascan( aini, { |e| upper( e[1] ) == upper( csection ) } )
) > 0 .and. ( nitem := ascan( aini[npos][2], { |e| upper( e ) ==
upper( citem ) } ) ) > 0
   if empty( cretval := aini[npos][3][nitem] )
      cretval := iniconvert( cdefault )
      iniput(cfile,csection,citem,cretval)
   endif
else
   cretval := iniconvert( cdefault )
   iniput(cfile,csection,citem,cretval)
endif
return cretval

*************
function iniitemexist( cfile, csection, citem )
return ascan( inigetsection( cfile, csection, .t. ), { |e| upper( e )
== upper( csection ) } ) > 0

*************
function inigetsection( cfile, csection, lgetname, lsectionname,
asection, aitem, lsave )

local npos, aretval := {}, aini := {}, lokpass

if( lgetname == nil, lgetname := .f. , )
if( lsectionname == nil, lsectionname := .f. ,)
if( lsave==nil,lsave := .f. ,)

aini := if( ( npos := iniisloaded( cfile ) ) > 0,;
   inifile[2][npos][2],;
   iniload( cfile )    )

if lsectionname
   aeval( aini, { |e| aadd( aretval, e[1] ) } )
else
   if ( npos := ascan( aini, { |e| upper( e[1] ) == upper( csection )

Quote:
} ) ) > 0

      if lgetname
         aeval( aini[ npos ][ 2 ], { |e| aadd( aretval, e ) } )
      else
         aeval( aini[ npos ][ 3 ], { |e,p| if( aini[npos][2][p] <> ";"
, aadd( aretval, e ),) } )
      endif
   else
      if !empty( asection ) .and. valtype( asection ) == "A"
         lokpass := ( valtype( aitem ) == "A" .and. len( aitem ) ==
len( asection ) )
         aeval( asection, { |e,i|;
         aadd( aretval, e ),;
         iniput( cfile, csection, if(lokpass,aitem[i],ltrim(str(i))),
e, .f. ) } )
         if lsave
            inisave( cfile )
         endif
      endif
   endif
endif

return aretval

*************
function iniput( cfile, csection, citem, xvalue, lcheck )

local npos, nitem, aini := {}, nlast, nini
local bini := { || if ( len( aini[npos][2] ) < 4096,(aadd(
aini[npos][2], citem  ),aadd( aini[npos][3], xvalue )),) }

if lcheck == nil
   lcheck := .t.
endif

if ( nini := iniisloaded( cfile ) ) > 0
   aini := inifile[2][nini][2]
else
   aini := iniload( cfile )
   nini := len( inifile[1] )
endif

nlast := len( aini )


if ( npos := ascan( aini, { |e| upper( e[1] ) == upper( csection ) } )
) > 0
   if lcheck
      if !empty( citem )
         if ( nitem := ascan( aini[npos][2], { |e| upper( e ) ==
upper( citem ) } ) ) > 0
            aini[npos][3][nitem] := xvalue
         else
            eval( bini )
         endif
      endif
   else
      eval( bini )
   endif
else
   if nlast > 0
      aeval( aini[nlast], { |e| aadd( e, "" ) }, 2, 2 )
   endif

aadd(aini,if(!empty(citem).and.!empty(xvalue),{csection,{citem},{xvalue}},{csection,{},{}}))
endif
inifile[2][nini][2] := aclone( aini )
return .t.

*************
function iniconvert( xvalue )

local ctype
if !( ctype := valtype( xvalue ) )$"CDNL"
   return ( xvalue := "" )
endif
return ( xvalue := eval( inifile[4][ascan(inifile[3],ctype)], xvalue )
)

*************
function inisave( cfile )

local nhandle
local t
local npos
local cret := chr(13)+chr(10)
local cini := ""
local eb, xx, i, j, y

if (npos:=iniisloaded(cfile))>0.and.(nhandle:=fcreate(cfile))<>-1

   if ( t := len(inifile[2][npos][1]) ) > 0
      for i := 1 to t
         cini += inifile[2][npos][1][i] + cret
      next
   endif

   if ( t := len(inifile[2][npos][2]) ) > 0
      for i := 1 to t
         eb   := inifile[2][npos][2][i]
         cini += "[" + inifile[2][npos][2][i][1] + "]" + cret
         if ( y := len( eb[2] ) ) > 0
            for j := 1 to y
               if !empty( eb[2][j] )
                  cini += eb[2][j] + if( eb[2][j] <> ";" ,"=", "" ) +
eb[3][j] + cret
               endif
            next
         endif
         if i < t
            cini += cret
         endif
      next
   endif

   fwrite(nhandle,cini+chr(26))
   fclose(nhandle)
   return .t.
endif
return .f.

*************
function inidel( cfile, csection, citem, ldelsection )

local npos, nitem, nnew, nini, aini, lret := .f.

if ( nini := iniisloaded( cfile ) ) > 0
   aini := inifile[2][nini][2]
else
   aini := iniload( cfile )
   nini := len( inifile[1] )
endif

if valtype( ldelsection ) <> "L"
   ldelsection := .f.
endif

if len( aini ) > 0
   if ( npos := ascan( aini, { |e| upper( e[1] ) == upper( csection )

Quote:
} ) ) > 0

      if ldelsection
         aini:deleteat( npos )
      else
         if ( nitem := ascan( aini[npos][2], { |e| upper( e ) ==
upper( citem ) } ) ) > 0
            aeval( aini[npos], { |e| e:deleteat( nitem ) }, 2, 2 )
         endif
      endif
      inifile[2][nini][2] := aclone( aini )
      lret := .t.
   endif
endif
return lret

--
Andi Jahja <andij at aonlippo dot co dot id>



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
Hi Ross,

Yes Pleeze!   :)

- Kevin
___________________________________________

O||||O   Its a jeep thing - - You wouldn't understand...
()()


Quote:
> On Wed, 26 Jul 2000 18:21:19 +1000, "Stephen Quinn"

snip

> In which case I should post the corrections (minor as they are) that
> are needed to make Peter Townsend's INIFILE.ZIP product work
> correctly.

> Regards,

> Ross McKenzie



Sun, 12 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE

Quote:

> Are you sure that freadline is a pure clipper function ?
> I know that fread is.  And with it, you specify the size of the buffer.
> However freadline is implemented, it may have a limitation.

FReadLn() is supplied along with other sample function to process
binary (and text) files in FileIO.PRG that is located in the Clipper's
/Source/Sample folder. Default buffer size for FReadLn() is just 80
characters, so additional parameter need to be passed to read longer
lines, e.g.

    nMaxLength := 10000
    FReadLn(hFile, 1, nMaxLength, CRLF)

Some other 3rd party libraries also have the function with the same
name (FReadLn), but their implementation (e.g. buffer size) could be
different.

--
Jovan Bulajic



Mon, 13 Jan 2003 03:00:00 GMT  
 255 Character Limit with FREADLINE
On Wed, 26 Jul 2000 01:38:44 GMT, "Michael J. Gregg"

Quote:

>Has anyone else experience this problem.

>I am building a program at work which needs to be able to read an INI style
>file, there is one line which
>is 280 characters.  And when I use the following:

>  cLineIn := freadline(nFileIn)

>It only reads in 255 characters.  Even if I do:

>  cLineIn := freadline(nInFile,512)

>I looked at my compile batch, which included this line:

>  SEARCH FUNBLINK  // WHAT DOES THIS DO????

>Which is Blinker, but am not sure what it does...

>Also, if I do this:

>  cLineIn := freadline(nInFile)

>  ? len(cLineIn)   // This displays 255 characters

>  cLineIn := freadline(nInFile)

>  ? len(cLineIn) // This displays 25 characters, it's like the buffer is
>being changed or something, what gives???

Try buffread.zip from The Oasis.

--

        Oasis WWW  http://www.the-oasis.net
         FTP Site  ftp://ftp.the-oasis.net
      Clipper FAQ  http://www.the-oasis.net/clipper.html
  Harbour Project  http://www.Harbour-Project.org

      Reality is the leading cause of stress
       among those who are in touch with it.



Mon, 13 Jan 2003 03:00:00 GMT  
 
 [ 18 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Scotty ; Socket to 255.255.255.255

2. CHARACTER *(*) to CHARACTER*255

3. How do I exceeding 255 file handle limit

4. How to overcome 255 file handle limit?

5. How do I exceeding 255 file handle limit

6. How to overcome 255 file handle limit?

7. How do I exceeding 255 file handle limit

8. How do I overcome 255 file limit?

9. Memo field larger than 255 characters

10. minor Python 1.5 bug: parser reports SyntaxError on reading character with code 255

11. Size of memofield - cant make it larger than 255 (CW5 PE)

12. LONGER STRING then 255 and prop:filter

 

 
Powered by phpBB® Forum Software