Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This forum is the most helpful site I've ever used. I used to use Deja.com; but, this site is better - hands down!..."

Geography

Where in the world do Tek-Tips members come from?
Blorf (Programmer)
9 Jan 04 14:26
Hello.

Writing updates to old Dbase Iv for Dos software that has to interact with modern stuff.  Problem I have is all my exports or outputs from Dbase terminate with the old EOF marker 0x0A.

Any body know haw to make Dbase not do that?

Thanks
NasibKalsi (Programmer)
11 Jan 04 23:32
Do you want to append to the file latter on ?
(Using External Programs or DOS copy program ?)
Blorf (Programmer)
12 Jan 04 10:33
No.  Once the file is written, will be e-mailed and used on another windows based system.  No appending.

The other system will import the data as a flat file, and sees the eof marker as an invlaid charachter.

Helpful Member!  dbMark (Programmer)
12 Jan 04 18:02
Note:  This code to truncate the file and remove the last END OF FILE marker has been tested but not thoroughly, so please try it only on copies until you are sure it works as you expect!

nSz=250
cFile="C:\temp\rpt.TXT"
nHandle=FOPEN(cFile,"RW")
IF nHandle=0
   ? cFile+" could not be opened low level."
ELSE
   ? "Processing "+cFile+"..."
   fEnd=FSEEK(nHandle,0,2)  && this is EOF
   xVal=FSEEK(nHandle,-1,1)  &&  one char before EOF
   fChr=FREAD(nHandle,1)  && get character
   IF fChr=CHR(26)
      ? "Found: CHR(26) at end of file."
      fEnd=FSEEK(nHandle,-1,1)  && one char before EOF
      xVal=FWRITE(nHandle,"",0)  && write nothing
   ELSE
      ? "Not found: CHR(26) - No action taken."
   ENDIF
   xVal=FCLOSE(nHandle)  && close truncates file after write of 0
   ? cFile+" has been closed."
ENDIF
RETURN

If you run the program against the file a second time it will say no action taken.

dbMark
Blorf (Programmer)
12 Jan 04 18:30
I will give the code a try, but first must ask, what language?  Is this Dbase Iv?  Hope so.

I already wrote a C version of the above, but had trouble running through dbase, because the server is old Novell, and it is forcing the following:
set comspec = Some old dos version compatible with Novell

And this caused problems for my C program.

Any way, will give the code a try.

Appreciate the help.

ChaZ
dbMark (Programmer)
13 Jan 04 9:01
This was tested in dBase 5 for DOS, but I don't see anything that probably wasn't already functional in dBase IV.
Blorf (Programmer)
13 Jan 04 20:10
Hi.  Tried the code, and it worked splendidly.

This is Odd, I wrote a very similar set of code in C to do this, and had the comspec problems I mentioned above.  I have been writing stuff in Dbase for these folks for years, and never had a need to even know it had such file handeling abilities.

What a trip.

Thanks very much again.

ChaZ
dbMark (Programmer)
14 Jan 04 11:46
Glad to hear it helps.  It shouldn't be hard at all to incorporate this method after the code that creates your reports and other output.

If this really works out for you as a good solution, there is a way to show your appreciation.  No money passes hands around here, but getting a Star as thanks for really helpful replies is the next best thing.
Blorf (Programmer)
14 Jan 04 11:54
Then you shall receive a star.  Being that I have programmed in Dbase since about 1982 and was not aware of fopen and fwrite options, you certainly added to my knowledge base.

Thanks,
ChaZ
NasibKalsi (Programmer)
3 Mar 04 22:03
Sorry missed at first instance, End of File Marker is 0x1A that is Decimal 26, not 0x0A and stipulated by Blorf. Howeve, dbMark has correctly solved the puzzle(Eof Mark).

Nasib Kalsi

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