How can I trim a file to say 2k??? 
Author Message
 How can I trim a file to say 2k???

Hi all,
I am looking for a pas program that will trim a .txt file to say 2k automatically, to trim the ever
growing files I have on my system, anyone know of one or any sugestions???
Sorry if this ? gets posted every day, but I am new here, and I have just finally got hold of my
first programming language (Turob Pascal 7.0 for dos), it is a little intimidating, but you have to
start somewhere right?

Thanx in advance for any help.

Hig.



Wed, 04 Aug 1999 03:00:00 GMT  
 How can I trim a file to say 2k???

Quote:

>Hi all,
>I am looking for a pas program that will trim a .txt file to say 2k automatically, to trim the ever
>growing files I have on my system, anyone know of one or any sugestions???
>Sorry if this ? gets posted every day, but I am new here, and I have just finally got hold of my
>first programming language (Turob Pascal 7.0 for dos), it is a little intimidating, but you have to
>start somewhere right?

Truncating a text file to 2k is like ripping off the first few pages of a phone
book and throwing the rest away!  I'm not so sure you're asking the right
question.  I think you might be choosing a solution based on your knowledge and
ability rather than stating the problem and letting others describe possible
solutions.

I'm sure you know that unwanted files can be removed with the DOS DEL or ERASE
commands.  You can copy (backup) files to diskette that you would like to keep,
but are not currently needed, then delete them from the hard disk.  You can also
archive files that are not currently needed thereby having them take less space.

I don't have the information readily available, but AFAIR a 255 meg partition
will have 4k allocation blocks and a 511 meg will allocate 8k blocks.  If this
holds than a 127 meg disk would allocate 2k blocks.  Question is, if your hard
drive is setup to allocate larger blocks, then storing a bunch of 2k files would
use only 50% of the medium.

If you really want to truncate text files to 2k, then open the file as a file of
byte, seek to position 2048, invoke the Truncate function, then close the file.
Voila, you've vaporized everything beyond the 2048th character.  After you do
this to a few files and begin to realize what you've done, you can go cry in
your beer.

    ...red

--
Roger E. Donais
Jacksonville, FL

http://users.southeast.net/~rdonais/index.html



Wed, 04 Aug 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. It's not bad canned meat...

2. String-functions TRIM(), SUBSTRING()

3. automatic trim in D6

4. apollo trim/alltrim error?

5. Ras and Win 2k

6. Win 2k - are there problems

7. Access 2k thru ODBC SLOW!!!!

8. Year 2K & Delphi

9. ALTER TABLE/ALTER COLUMN problem with MS Access 2K

10. Pascal evaluation order: how does Borland do it and what says the standard

11. DOS or Windows? (Please say DOS)

12. Oh, say, can you C?

 

 
Powered by phpBB® Forum Software