Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to test console application
Message
 
 
À
24/09/2008 00:44:13
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01349592
Message ID:
01350167
Vues:
19
Great catch! I didn't notice it.

Well, actually it was just a job position with this program included. The person who advertized this job wants to have a phone interview with me now, we were supposed to have it today, but he re-scheduled for tomorrow.

>It also states that the purpose of the program is to find all occurrences, yet it only finds the first.
>
>Did you "pass" the interview?
>
>~~Bonnie
>
>
>
>>Hi everybody,
>>
>>This is actually sort of an initial interview question. I have this program
>>
>>using System;
>>
>>namespace CreditSights
>>{
>>    /// <summary>
>>    /// The purpose of this program is to read in a file and search for all
>>    /// occurrences of the string passed in. 
>>    /// 
>>    /// e.g. SearchForText.exe autonomous resume.txt
>>    /// e.g. SearchForText.exe smart resume.txt
>>    /// </summary>
>>    class SearchForText
>>    {
>>        static void Main(string[] args)
>>        {
>>            string toFind = args[1];
>>            string file = args[2];
>>
>>            string text = System.IO.File.OpenText(file).ReadToEnd();
>>
>>            Console.WriteLine("Found it at: " + text.IndexOf(toFind));
>>        }
>>    }
>>}
>>
>>And I need to figure out what is wrong with it. I created a new Console application but then I try to debug it I obviously get an error. So, my question is how to test it.
>>
>>Also in terms of what is wrong here I guess no error checking is the first thing that is wrong. But what else is wrong?
>>
>>Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform