Loading ...
Sorry, an error occurred while loading the content.

Re: Searching a WordPerfect file

Expand Messages
  • Rod
    t$=Input$(#handle,length) Is what you need, #handle is the #name you used to open the file for input. Length is whatever length in bytes you want to input.
    Message 1 of 3 , Mar 25 12:08 AM
    • 0 Attachment
      t$=Input$(#handle,length)
      Is what you need, #handle is the #name you used to open the file for input. Length is whatever length in bytes you want to input. Lof(#handle) is the length of the whole file, if you need it in chunks use this as your length to break into chunks. Suppress the calf when writing to your output file by appending ; to the print statement, #handle newt$;

      --- In libertybasic@yahoogroups.com, David Speck <MedelecInstruments@...> wrote:
      >
      > KK
      >
      > As long as the file length is something under 70 megs, you can open it
      > for binary access, read it into a huge string, and manipulate it that way.
      >
      > If the file is larger than that, you will have to access it on the
      > disk. Open the source file for input as binary, then open a second
      > output file, with a different name. Read chunks from the source,
      > looking for the substitution targets along the way. Transfer the chunks
      > from the source file to the destination file, making appropriate
      > substitutions along the way. When complete, either delete the source,
      > or better yet, leave the source untouched and have the output file be
      > some sort of modified file name.
      >
      > HTH,
      >
      > Dave
      >
      > BTW: Does Titian2 refer to the missiles?
      >
      >
      >
      > On 3/24/2013 11:20 PM, titan2guy wrote:
      > > I want to reorganize some files in a different structure. The files are documents in WordPerfect and use other documents as "subdocuments". To do my reorganization, I have to change the path to the files.
      > >
      > > I want to read in an entire WordPerfect document, search for some sub-document filenames and replace them with other names. I can do it in HxD - HexEditor (freeware -- very nice product, by the way) and have used LB to produce the hex strings I need to search for and replace. It works, but is quite tedious. I think I can use LB to do the repetitious part if I can just get the whole file in a string variable. I need to do at least 66 documents.
      > >
      > > So far, I can open and read the a chunk of the document, but not the whole thing. What can I use to input the entire document into a single string in LB? There are all sorts of strange hex values in the file. X'00' is very common; X'FF' is the first value in the file.
      > >
      > > INPUTTO$(#handle, delim$)
      > > appears to be what I want, but what do I use for a delimiter?
      > >
      > > Thanks in advance for any help.
      > >
      > > KK
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.