Announcement

Collapse
No announcement yet.

CONS: Redirection Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CONS: Redirection Problem

    Hello folks... yes I'm back... been gone for awhile and been doing alot of graphic stuff, but have recently been dusting off my PowerBASIC books and attempting my hand at CGI programming in PB 3.5 and ran into a little snag when it comes to redirection. Now I know that PBCC supports the STDOUT feature, but what really busts my butt is that it doesn't support the MAP String$$ functions or the SHARED variables in sub/functions unless you declared them GLOBAL... so here's my problem...

    - Take any GIF/JPG file... let's say PICTURE.JPG...
    - Open up your CONS: for STDOUT output
    - Open your pic file and red the contents into a string
    - Print that string out to CONS: for redirection

    Here's what I discovered... no matter what the setting of the

    $LIB IPRINT on|off

    It will replace CHR$(9) with a Space! What's up with this?

    Okay... try this code out:

    OPEN "O", 1, "FILE.TXT"
    PRINT #1, CHR$(8,9,10);
    CLOSE #1

    OPEN "O", 1, "CONS:"
    PRINT #1, CHR$(8,9,10);
    CLOSE #1

    Compile and run the program... with the following command line:

    STDOUT.EXE > FILE.SCR

    Now take a look at the files... they should both contain CHR$(8,9,10) but NOOooooooooooooooooo... FILE.SCR contains CHR$(8, 32, 10)... so here's the challenge... can anyone figure out a way to bypass this little problem? Let me know!


    ------------------
    -=> James "The Garf!" Davis! <=-
    Even if you think you don’t love mathematics,
    mathematics loves you. Don’t believe me?
    Solve the following for “i”.
    9x – 7i > 3(3x – 7u)

  • #2
    My compiler is PB 2.1f so your may be a little different. In
    the menu bar, go to Options > Linker and make sure the
    Interpreted print is OFF. This should take care of your TAB
    problem. If it's ON the compiler will "intreperate" the tab
    as a space.

    ------------------


    [This message has been edited by Mel Bishop (edited March 13, 2001).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      PB/DOS 3.5 also supports STDOUT, and from my tests, STDOUT does not translate the CHR$(9) into a CHR$(32), but OPEN "CONS:" does appear to be affected.

      STDOUT CHR$(8,9,10,26);

      I'll have to clarify with R&D why this occurs, but I suspect it is some kind of BIOS interraction.


      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment

      Working...
      X