Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


alternate has blank line??

alternate has blank line??

alternate has blank line??

If I do "set alte to xxx", and "set alte on", type a line like "? test", then "close alte", and take a look at xxx.txt, there is a blank line at the top of the file. This is causing a problem in my application... I want the text to start on the first line.

Any thoughts/solutions???


RE: alternate has blank line??

Hi, FB9

If you use ? to print then whatever you print is prefixed with a carriage return/line feed (chr(10)+chr(13)).

To suppress that, use ?? instead.

However, if you want the crlf at the end of the line then you will either have use ? on all subsequent lines or put out crlf's explicitly where/if needed.


RE: alternate has blank line??

Thanks, JockMullin... only trouble is, that doesn't seem to work! If I substitute ??"test" right after "set alte on", it puts the lines together on the alte file, but there's still the blank line before all that.

How can I get NOT generate that blank line (or get rid of it)??!!


RE: alternate has blank line??

Hi, Frank

I just compiled the following prog here:

set alternate to test.txt
set alternate on
set console off
?? "TEST"
set console on
set alternate off
set alternate to

After running it the output file test.txt is a 5 byte file. Looking at it with a hex editor it contains "TEST" followed by ascii 1A - the DOS end of file character. No blank line.

What version of Clipper are you using? I tested with Clipper Summer ;87, 5.2e and xHarbour 0.99.60 and all produced identical output.


RE: alternate has blank line??


I have seen this before,  it's phsyically buts a blank line at the very top of the output.  I've just worked around it and haven't ever figured our why.


Jim C.

RE: alternate has blank line??

Here's a code clip from my "837 EDI file generator" program. I had the same problem that I had to work around. Here is the current code.


SET ALTERNATE TO ( cFileName )  //  file info is stored in

?? ISA(cSenderIdISA, cRcvrIdISA , cInterchangeNum)  //Interchange
?? GS( cSenderIdGS , cRcvrIdGS  , cGroupNum)  // Group Header

The trick might be SET CONSOLE OFF, but this code works in my application.

Jim Rumbaugh

RE: alternate has blank line??

Well, maybe Frank is typing the commands into a dot prompt.
In that case you can't set console off, and when the prompt is displayed or command window is cleared maybe that is also being sent to the output file.

In any case, if the amount of text you want to write into the file isn't too large, you could use memowrit() instead. Then it would be just one line:


That also gets me just a 5-byte test.txt file as before.

And then there are also the low level file functions, but the set alternate method SHOULD work - I do it all the time to write CSV files and my header line is indeed the first line.

Jock (scratching head).

RE: alternate has blank line??

Thanks, everyone... got it solved, but am still not certain what the deal was... seemed to get inconsistent results. You're right, JockMullin, I was typing into a dot prompt for trial purposes, then just made a plain .prg file for test purposes, finally realized I couldn't legitimately test that way, so compliled it. I think the answer was your original suggestion... use ?? rather than ?... I'd just tried it at the dot prompt and it didn't help. Set console on/off didn't seem to make a difference.

Anyway, thanks again for all the feedback!!


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close