New call-to-action
Results 1 to 3 of 3

Thread: file write command

  1. #1
    Member
    Real Name
    Frank G Pylant
    Join Date
    May 2000
    Location
    Gardendale Alabama
    Posts
    163

    Default file write command

    Hello All

    I am using the file open command to open a file and then using the file write command to write a header file.
    My problem is that it is over writing the first line in the file. How can I have it not overwrite that first line, but insert the first line for a header? Also how can I have it go to the end if the file to put on a footer?

    Thanks
    Greg Pylant

  2. #2
    Member
    Real Name
    Frank G Pylant
    Join Date
    May 2000
    Location
    Gardendale Alabama
    Posts
    163

    Default RE: file write command

    Also can I write values from fields in the write command?

    Thanks
    Greg Pylant

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,317

    Default RE: file write command

    Frank,

    spend a few minutes in ch. 18 of the xbasic Ref. manual.

    You can advance through the file character by character with file.read(number_of_characters).

    You can advance through the file line by line with file.read_line()

    File.eof() will return true if you hit the end of file while reading...

    file.pos_get() will return the position in the file of your file pointer.

    file.seek() permits you to read or write data to a particular location in the file.


    To add a line to an existing file, you either:

    a) read the existing file, until you get to the end, and then write the next text to the same file (remembering to add cr and lf if needed); or

    b) store each read line in memory, add the new text you want to send, and then re-write the entire file.

    Hope this gets you going.

    -- tom

Similar Threads

  1. Help with write to file
    By Peter Lear in forum Alpha Five Version 5
    Replies: 3
    Last Post: 02-13-2003, 10:31 PM
  2. file.write v. file.write_line
    By Graham Wickens in forum Alpha Five Version 4
    Replies: 1
    Last Post: 06-04-2002, 06:35 AM
  3. urgent.. Help can't write to the .dbf file
    By abe kravetz in forum Alpha Five Version 4
    Replies: 1
    Last Post: 10-17-2001, 09:51 PM
  4. urgent.. Help can't write to the .dbf file
    By abe kravetz in forum Alpha Five Version 4
    Replies: 0
    Last Post: 10-17-2001, 12:40 PM
  5. File.Write Line Command
    By Thomas Holt in forum Alpha Five Version 4
    Replies: 7
    Last Post: 09-14-2000, 09:43 AM

Bookmarks

Posting Permissions

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