Page 1 of 1

DOS pipe question

Posted: Fri Jun 30, 2006 9:39 am
by webbmeister
if I compile the following code to an exe (c:\list.exe) ...

Code: Select all

OpenConsole()

For i=1 To 10

PrintN("Line "+Str(i))

Next i
Comiled as as UTF-8, Console

If I open a dos prompt and type...

C:>List.exe >c:\list.txt

the output is not
Line 1
Line 2
Line 3
etc

Image

I'm sure is something to do with ANSI vs UFT-8

Posted: Fri Jun 30, 2006 9:49 am
by Michael Vogel
But...

Code: Select all

Print("Test"+#crlf)
...works (hopefully).

Posted: Fri Jun 30, 2006 9:55 am
by webbmeister
I Get "Constant Not Found:#crlf"

Posted: Fri Jun 30, 2006 10:09 am
by netmaestro
#CRLF$

It has the $ on the end to denote that it's a string constant.

Posted: Fri Jun 30, 2006 10:17 am
by webbmeister
That's folks, that works great. Why does PrintN() not do the same? It's going to be a real pain :shock: to mod all the printn statements in my 2000 line project!! is there a way of making PrintN() behave its self??

Posted: Fri Jun 30, 2006 11:20 am
by Kale
webbmeister wrote:That's folks, that works great. Why does PrintN() not do the same? It's going to be a real pain :shock: to mod all the printn statements in my 2000 line project!! is there a way of making PrintN() behave its self??
Put this at the top of your source:

Code: Select all

Macro PrintN(Text)
    Print(Text + #CRLF$)
EndMacro
Untested but you get the idea. ;)