Files
harbour-core/harbour/tests/longdev.prg
Viktor Szakats 1963970a1d 2008-08-07 21:49 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/examples/pp/pp.c
   * contrib/hbmisc/fileread.prg
   * contrib/hbmisc/tests/readfile.prg
   * contrib/hbmisc/tests/twirl.prg
   * contrib/hbmisc/twirler.prg
   * doc/en/readme.txt
   * doc/es/readme.txt
   * harbour-ce-spec
   * harbour-w32-spec
   * harbour.spec
   * source/rtl/achoice.prg
   * tests/boxtst2.prg
   * tests/delimtst.prg
   * tests/devtest.prg
   * tests/disptest.prg
   * tests/inkeytst.prg
   * tests/longdev.prg
   * tests/output.prg
   * tests/round.prg
   * tests/sbartest.prg
   * tests/scroll.prg
   * tests/sdf_test.prg
   * tests/seconds.prg
   * tests/setkeys.prg
   * tests/testhtml.prg
   * tests/version.prg
   * utils/hbdoc/hbdoc.prg
     * Minor formattings, cosmetic updates, 
       homepage made lower case everywhere.
2008-08-07 19:54:10 +00:00

43 lines
1.3 KiB
Plaintext

//
// $Id$
//
// Testing Harbour long string handling with device output.
/* Harbour Project source code
http://www.harbour-project.org/
Donated to the public domain on 2001-03-08 by David G. Holm <dholm@jsd-llc.com>
*/
FUNCTION Main()
LOCAL cShort := "1234567890"
LOCAL i, j, cLong, cBuffer, nHandle
// Create an 80 KB string (Clipper is limited to 64 KB).
cLong := cShort
FOR i := 1 TO 13
cLong += cLong
NEXT
// Write the long string to file long_str.prn
SET PRINTER TO long_str
SET DEVICE TO PRINTER
DEVOUT( cLong )
SET PRINTER OFF
SET DEVICE TO SCREEN
// Confirm the string length and that a copy is exactly identical.
? "The length of the long string is", IF( LEN( cLong ) == 80 * 1024, "correct", "wrong" )
cBuffer := cLong
? "The length of a copy of the long string is", IF( LEN( cLong ) == 80 * 1024, "correct", "wrong" )
? "The copy of the long string is", IF( cLong == cBuffer, "equal", "not equal" ), "to the long string"
// Read the string back in and compare it to the original.
nHandle := FOPEN( "long_str.prn" )
cBuffer := FREADSTR( nHandle, 90000 )
? "Original:", LEN( cLong )
? "From file:", LEN( cBuffer )
? "The strings are", IF( cLong == cBuffer, "equal", "not equal" )
return nil