Read txt data with C

Updated on technology 2024-02-08
4 answers
  1. Anonymous users2024-02-05

    using system;

    using ;

    using ;

    static void main(string args) reads all lines of the file at once.

    string lines = "");

    Output. foreach(string line in lines)string words = getwords(line);

    According to the file format, the 0th word is the username and the 1st word is the password.

    name: password:", words[0], words[1]);

    Take out the words in each line.

    Lines (an indefinite number of spaces between words).

    An array of words after removing the spaces.

    static string getwords(string line)

    string words = char

    listrealwords = new list();

    foreach (string word in words)if (!

    return ;

    Here's the point: filter out the spaces created after each line is split to get the real words. See the getword method in the program above.

  2. Anonymous users2024-02-04

    After reading the text text, create a class with 4 properties: name, password, sno, cno;

    Then each row is saved to the list collection, and the object is directly assigned a value through the object initializer (name=x, passw=d, sno=2, cno=1), and then iterates through the list collection, and the object is directly output for which value you want. properties on it.

  3. Anonymous users2024-02-03

    Store the data of each row in an array and access it with array subscripts.

  4. Anonymous users2024-02-02

    var file = "d:\\", ;listtxt = new list();using (var stream = new streamreader(file))}var array = new string[10,10];var line = 0; => )line++;

    Hope it solves your problem.

Related questions
20 answers2024-02-08

The drop-down box contains multiple items, and the text that can read one of the items in the drop-down box (n represents the index). >>>More

14 answers2024-02-08

The software that modifies game data (money, blood, attack power, etc.) on mobile phones is called "Yagamimon". Run the Yashen Gate Device first, run the game (so that there will be a small icon of the Yashen Gate Device after entering the game), after entering the game, first look at what the data value you want to modify is, for example, after entering the game, the money is 100, don't continue to play the game, click on the Yashen Gate icon, there is an input box after entering the Yashen interface, enter the value of the data you want to modify, for example, the money mentioned above is 100, enter 100, click on the search behind (at this time, there are several search modes, just choose the first one, In fact, you can understand what these patterns mean when you look at the name), and there will be a lot of data after searching, and each of these data is related to 100. At this time, it is impossible to determine which piece of data is money. >>>More

9 answers2024-02-08

It can be implemented in all programming languages, but the difficulty of implementation is different. >>>More

21 answers2024-02-08

No, if the C disk accounts for 50 -70, it will affect the speed of the system >>>More

8 answers2024-02-08

If it's a hard disk version of ghost, just restore it directly. >>>More