fodev.net
FOnline Development => General Discussion => Topic started by: Mr Feltzer on September 08, 2013, 08:23:21 am
-
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.
-
In C# you can read the entire contents of the file in a string, then split the string using a delimiter ('\n')
-
Ah yes. Good Thinking haha
Edit:
Bastard Error my friend.
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. @_@
Any ideas? I have worked with strings before and have never seen this issue.
-
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.
-
You can also split strings in angelcode using one of these:
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.
-
You can also split strings in angelcode using one of these:
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.
Excellent! that did the trick!
@k3tamina
In all my previous experiences with C#, an Index on a string locates a char or part of the string.
example
string lestring = "hax";
lestring[0] would be h
Obviously Angel has changed a tad more than I expected.