Results 1 to 3 of 3

Thread: Another File Writing Question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Hi.

    I want to limit a filesize
    to say .5k and delete the TOP of
    the file and leave the bottom!


    For Example.. Heres a text file
    before the code would have been
    ran with it.

    Microsoft Windows 98 Second Edition
    README for Frequently Asked Questions
    April 1999
    -------------------------------------------------

    (c) Copyright Microsoft Corporation, 1999


    This document provides complementary or late-breaking
    information to supplement the Microsoft Windows 98
    Second Edition documentation.

    ------------------------
    HOW TO USE THIS DOCUMENT
    ------------------------

    To view FAQ.txt on-screen in Notepad, maximize
    the Notepad window.

    To print FAQ.txt, open it in Notepad or another
    word processor, and then on the File menu, click Print.

    NOTE: Some of the information in this document applies
    only to the Windows 98 Second Edition Upgrade. If
    Windows 98 Second Edition was preinstalled on your
    computer, the upgrade-specific information may not
    apply.
    And THIS is what it would look like after
    the code trimed the text to under .5k
    HOW TO USE THIS DOCUMENT
    ------------------------

    To view FAQ.txt on-screen in Notepad, maximize
    the Notepad window.

    To print FAQ.txt, open it in Notepad or another
    word processor, and then on the File menu, click Print.

    NOTE: Some of the information in this document applies
    only to the Windows 98 Second Edition Upgrade. If
    Windows 98 Second Edition was preinstalled on your
    computer, the upgrade-specific information may not
    apply.
    Ya see how the top of the textfile is deleted.
    That is what I want! How could I do That?

    [Edited by Evan on 10-29-2000 at 12:05 PM]

  2. #2
    Guest
    Code:
    Dim sString As String
    sString = Mid(sString, Len(sString) / 2 + 1)
    That should do the trick. Let me know if it works ok.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    A bit more than that..
    Code:
    Dim buffer As String, start As Long
    Open file For Binary As 1
        buffer = Space(LOF(1))
        Get #1, , buffer
        start = 5120 - LOF(1)
        If start < 0 Then start = 0
        buffer = Mid(buffer, start)
    Close 1
    Open file For Output As 1
    Close 1
    Open file For Binary As 1
        Put #1, , buffer
    Close 1
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width