FOnline Development > General Discussion

Reading from a file to return a string[] array

(1/2) > >>

Mr Feltzer:
Hello, I have been working on a new bunch of systems and the documentation on the file reader is horrible.

IS there ANY way to read from a file and return every Line as a string within an Array?

Thanks lads, Good day.

k3tamina:
In C# you can read the entire contents of the file in a string, then split the string using a delimiter ('\n')

Mr Feltzer:
Ah yes. Good Thinking haha

Edit:
Bastard Error my friend.

--- Code: ---string filestring;
if(filestring[i] == "\n") // This returns Error: "No conversion from 'string@&' to 'uint' available." Even though I am simply gathering a string with an index. @_@

--- End code ---

Any ideas? I have worked with strings before and have never seen this issue.

k3tamina:
Just read what the error says, you're comparing a uint (wide char filestring[ i ]) with a string ("\n"), it's like comparing carrots and apples.

Lidae:
You can also split strings in angelcode using one of these:


--- Code: --- string[]  split (const string& in str, const string& in delimiter)
  Splits the string into an array of substrings.
 
string[]  splitEx (const string& in str, const string& in delimiter)
  Splits the specified string by string, using the specified separator.

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version