DOS pipe question

Just starting out? Need help? Post your questions and find answers here.
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

DOS pipe question

Post 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
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

But...

Code: Select all

Print("Test"+#crlf)
...works (hopefully).
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

Post by webbmeister »

I Get "Constant Not Found:#crlf"
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

#CRLF$

It has the $ on the end to denote that it's a string constant.
BERESHEIT
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

Post 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??
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post 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. ;)
--Kale

Image
Post Reply