View Single Post
Old September 30th, 2012 (10:57 AM).
Umbra's Avatar
Umbra Umbra is offline
Platinum Tier
Join Date: Aug 2009
Location: Nearby my feet.
Age: 19
Gender: Female
Nature: Calm
Posts: 1,742
Originally Posted by Cilerba View Post
I'd love to make it edit actual PBS files but I have no idea how to go about doing that. This is kind of my first real program so I'm sort of learning as I go on.
Easy one:

Ruby Example:
# to retrieve
def get_item(item)
 array = IO.readlines("PBS/Items.txt")
 return array[item]

# to edit
def edit_item(item, data)
  array = = IO.readlines("PBS/Items.txt")
  array[item] = data
  file ="PBS/Items.txt", 'wb')
  for i in 0..array.length-1
Sorry if this is wrong, but this is how I remember Ruby IOs to work. In the end run you will still need to convert the data somehow. Yes I know this is useless as of you are coding this in c++ probably, I just put it out there as an example of how the basis can go towards