Mono Tutorial - LXF 88 page 97

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Mono Tutorial - LXF 88 page 97

Postby hedknox » Sun Jan 28, 2007 1:23 pm

I've been following the Mono tutorial pretty well so far. I had a problem with the Console.Write call but resolved it when I specified System.Console.Write instead since the tutorial moved from using system to using system.IO.........but thats all beside the point :roll:

I'm at the Big Finale stage in the second tutorial LXF 88 page 97. When I replace my existing Main() with the code as specified I get an error at line 21, the last line which is just a closing brace
ie {
The error description is "Expecting `;'(CS1002)" for the file Main.cs

Any ideas what I'm doing wrong here? :? I'm running Fedora Core 6 on a dell laptop which i built specifically for the tutorial and i've installed all the packages required.

Incidentally FC6 is running way slow on this, Ubuntu ran v quick.
hedknox
 
Posts: 3
Joined: Sun Jan 28, 2007 12:42 pm

Postby lis » Mon Jan 29, 2007 7:08 pm

If you put all of the code (of the app) here, we might be able to reproduce the errorMessage and give it a try to resolve it.
But at first glance it sounds like a typo.

Lis
User avatar
lis
 
Posts: 57
Joined: Thu Nov 30, 2006 1:50 pm
Location: Noord Holland, the Netherlands

Postby hedknox » Wed Jan 31, 2007 10:34 pm

Heres the code, i'm sure it's just some typo but am brand new to this so it's not obvious to me,.......

// project created on 1/20/2007 at 1:55 AM
using System.IO;

namespace Pipeknot
{
class Pipeknot
{
public static void Main(string[] args)
{
if (args.Length == 0){
string[] files = Directory.GetFiles("/home/rherron","*.txt",
SearchOption.AllDirectories);
File.WriteAllLines("filecache.pipeknot",files);
} else {
string[]cache=File.ReadAllLines("filecache.pipeknot");
foreach(string file in cache){
if (file.Contains(args[0])){
System.Console.Write(File.ReadAllText(file));
}
}
}
hedknox
 
Posts: 3
Joined: Sun Jan 28, 2007 12:42 pm

Postby hedknox » Wed Jan 31, 2007 10:49 pm

Ooops,... I did a quick brace count, added three more in, and guess what,...it worked
hedknox
 
Posts: 3
Joined: Sun Jan 28, 2007 12:42 pm

Postby Hudzilla » Wed Jan 31, 2007 11:47 pm

Looks like you fixed your own problem - well done!

As a side note, try having "using System;" and "using System.IO;" in the same script, one per line - that will let you go back to using Console.Write rather than System.Console.Write, as well as having the File and Directory classes.
User avatar
Hudzilla
Site admin
 
Posts: 265
Joined: Mon Apr 04, 2005 11:52 am
Location: LXF Towers


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest