FIle
-
Hi How i can get some information from file which is separeted by semicore. For example. name;age;sex; i need to put all this into array how to do it?
when i want to read something good just seat and type it
-
Hi How i can get some information from file which is separeted by semicore. For example. name;age;sex; i need to put all this into array how to do it?
when i want to read something good just seat and type it
read all the data from the file and store it in a string. then use the string.split() method of c# to split the array. this will return you array having all the records in it without semicore. the syntax is string selectedNode; // to store data from file char[] splitter = { ';' }; // splitter to be used string[] machineNode; // array which will contain the data after splitting the //string machineNode = selectedNode.Split(); now u can use machineNode as any array to retrieve data. regards
sAqIb
-
Hi How i can get some information from file which is separeted by semicore. For example. name;age;sex; i need to put all this into array how to do it?
when i want to read something good just seat and type it
Hope this helps Regards private void _parse(string sourceFile) { string[] tokens; // Check if source file exists if (File.Exists(sourceFile) == false) throw new Exception("Source file does not exist"); TextReader TR = File.OpenText(sourceFile); // Parse file for (string currentLine = TR.ReadLine(); currentLine != null; currentLine = TR.ReadLine()) { tokens = currentLine.Split(";".ToCharArray()); } TR.Close(); }
-
Hi How i can get some information from file which is separeted by semicore. For example. name;age;sex; i need to put all this into array how to do it?
when i want to read something good just seat and type it