Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
GeneralRe: My vote of 1 Pin
OriginalGriff9-Mar-10 0:34
mveOriginalGriff9-Mar-10 0:34 
GeneralRe: My vote of 5 Pin
OriginalGriff8-Mar-10 22:39
mveOriginalGriff8-Mar-10 22:39 
QuestionUnstoppable process from Task Manager Pin
Ihtesham8-Mar-10 21:03
Ihtesham8-Mar-10 21:03 
AnswerRe: Unstoppable process from Task Manager Pin
Calla8-Mar-10 21:10
Calla8-Mar-10 21:10 
GeneralRe: Unstoppable process from Task Manager Pin
Ihtesham8-Mar-10 21:13
Ihtesham8-Mar-10 21:13 
GeneralRe: Unstoppable process from Task Manager Pin
Calla8-Mar-10 22:07
Calla8-Mar-10 22:07 
GeneralRe: Unstoppable process from Task Manager Pin
Ihtesham8-Mar-10 22:19
Ihtesham8-Mar-10 22:19 
QuestionFinding the nearest value within a .txt file that is above another value Pin
suprsnipes8-Mar-10 18:37
suprsnipes8-Mar-10 18:37 
Hi,

I have only been using C# for a few weeks now and have recently found the following code and adjusted it to read a text file on my PC. It appears to be working as it is printing all of the data as expected to the screen in the following format;

3869;
4758;
7890;
9943;

and so on;

I would like to ask what is the best way to find the nearest value within the .txt file that is above another value. Let's say in the case the value is 4991 then I would like to return the value of 7890 only.

{
			readText = File.ReadAllText("C:\\PIn.txt");
				
			string [] split = readText.Split(new Char [] {';'});
				foreach (string s in split)
				{
					count++;
					levels[count] = int.Parse(s);
					//Print(levels[count]);
				}
				Print(readText);

}


As a newbie I really appreciate the help so thank in advance,
suprsnipes
AnswerRe: Finding the nearest value within a .txt file that is above another value Pin
Calla8-Mar-10 20:03
Calla8-Mar-10 20:03 
GeneralRe: Finding the nearest value within a .txt file that is above another value Pin
suprsnipes8-Mar-10 21:32
suprsnipes8-Mar-10 21:32 
GeneralRe: Finding the nearest value within a .txt file that is above another value Pin
Calla8-Mar-10 22:02
Calla8-Mar-10 22:02 
QuestionWhich option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Nadia Monalisa8-Mar-10 15:55
Nadia Monalisa8-Mar-10 15:55 
AnswerRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Scott Dorman8-Mar-10 16:22
professionalScott Dorman8-Mar-10 16:22 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Nadia Monalisa8-Mar-10 17:24
Nadia Monalisa8-Mar-10 17:24 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Luc Pattyn8-Mar-10 17:45
sitebuilderLuc Pattyn8-Mar-10 17:45 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
OriginalGriff8-Mar-10 22:37
mveOriginalGriff8-Mar-10 22:37 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Scott Dorman9-Mar-10 3:41
professionalScott Dorman9-Mar-10 3:41 
AnswerRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Luc Pattyn8-Mar-10 16:25
sitebuilderLuc Pattyn8-Mar-10 16:25 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Nadia Monalisa8-Mar-10 17:28
Nadia Monalisa8-Mar-10 17:28 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Luc Pattyn8-Mar-10 17:41
sitebuilderLuc Pattyn8-Mar-10 17:41 
AnswerRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
PIEBALDconsult8-Mar-10 17:41
mvePIEBALDconsult8-Mar-10 17:41 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Luc Pattyn8-Mar-10 17:49
sitebuilderLuc Pattyn8-Mar-10 17:49 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
PIEBALDconsult9-Mar-10 3:20
mvePIEBALDconsult9-Mar-10 3:20 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
Luc Pattyn9-Mar-10 3:24
sitebuilderLuc Pattyn9-Mar-10 3:24 
GeneralRe: Which option is better for Reading file. File.ReadAllText(fileName) OR StreamReader Pin
PIEBALDconsult9-Mar-10 6:16
mvePIEBALDconsult9-Mar-10 6:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.