Jump to content
  • 0

hledám C# ReadLines


DexterSK_

Dotaz

Ahoj, chcel by som sa opýtať ako môžem vytiahnuť text zo súboru podľa riadkov, skúšal som to takto ale hneď po spustení mi to crashlo

 

string subor = @"udaje.dat";

string[] lines = File.ReadAllLines(subor);
string id = lines[1];
string heslo = lines[2];
Link to comment
Share on other sites

3 odpovědí na tuto otázku

Recommended Posts

  • 0

Je to napísane dobre. Btw ta @ je tam zbytočne keď v tej ceste nemáš / :),

Ak máš v súbore len 2 riadky tak ti chybu háďze za to.

Start index v tom lines[] začína od 0 čiže lines[0] je riadok 1, lines[1] riadok 2

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...