Results 1 to 7 of 7

Thread: Difficulties with creating a file...

  1. #1
    Join Date
    Sep 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Difficulties with creating a file...

    How would I create a new *.txt file in SCAR, at a specified path, and have it write a string to it?

    This function looks like it might be useful:
    function WriteFileString(FileNum: Integer; s: string): Boolean;

    But I don't think it will create a new file if one doesn't already exist, and I don't know what a"FileNum" is.

    Thanks,
    ~Macros
    Current Project - Superheater :: Mithril Bars - Should be ready for Members application soon

  2. #2
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SaveToFile(List, AppPath + 'Quickmarch\Proggy\GSProggy ' + TheDate(3) + '.txt');

    CREDITS TO QUICKMARCH's GOB SHREDDER! GREAT SCRIPT! USER IT

  3. #3
    Join Date
    Sep 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What's a TObject and how would I convert a string into one? (The first argument of that function).

    It says: "Saves the content of certain objects:
    TStrings, TStringList, TBitmap, TImage, TPicture, TMemo, TListBox, TComboBox, TRichEdit, TCheckListBox, TGraphic"
    In the manual.

    So I'm guessing I'd want a "TStrings"? But I still don't see how to write a string to the file!

    Thanks again =p
    Current Project - Superheater :: Mithril Bars - Should be ready for Members application soon

  4. #4
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SaveToFile();

    look at the params >.> the first is a TObject

  5. #5
    Join Date
    Sep 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea I didn't know what a TObject was. Buut, I just looked at Goblin Shredder, and what do you know, it explains everything!

    Thanks!
    Current Project - Superheater :: Mithril Bars - Should be ready for Members application soon

  6. #6
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    mhmm.

  7. #7
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Here's the way I always do it-
    SCAR Code:
    var
      FileNumber: integer;

    begin
      FileNumber:= RewriteFile(Path, Shared); //or use OpenFile if the file already exists and you don't want to erase what is in it
      WriteFileString(FileNumber, Text);
      CloseFile(FileNumber);
    end;

    And that is how you use filenumber.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating Forms?
    By FortAsh in forum OSR Help
    Replies: 5
    Last Post: 01-21-2009, 01:46 PM
  2. Case difficulties.
    By Macros in forum OSR Help
    Replies: 4
    Last Post: 01-08-2009, 11:47 PM
  3. Creating a VM {Vid}
    By Dark_Sniper in forum Computer Help and Tutorials
    Replies: 50
    Last Post: 05-16-2008, 09:51 PM
  4. Having some slight difficulties
    By Raskolnikov in forum OSR Help
    Replies: 1
    Last Post: 01-04-2008, 10:17 PM

Posting Permissions

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