Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mono Tutorial - LXF 88 page 97

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
hedknox



Joined: Sun Jan 28, 2007 12:42 pm
Posts: 3

PostPosted: Sun Jan 28, 2007 1:23 pm    Post subject: Mono Tutorial - LXF 88 page 97 Reply with quote

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 Rolling Eyes

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? Confused 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.
Back to top
View user's profile Send private message
lis



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

PostPosted: Mon Jan 29, 2007 7:08 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
hedknox



Joined: Sun Jan 28, 2007 12:42 pm
Posts: 3

PostPosted: Wed Jan 31, 2007 10:34 pm    Post subject: Reply with quote

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));
}
}
}
Back to top
View user's profile Send private message
hedknox



Joined: Sun Jan 28, 2007 12:42 pm
Posts: 3

PostPosted: Wed Jan 31, 2007 10:49 pm    Post subject: Reply with quote

Ooops,... I did a quick brace count, added three more in, and guess what,...it worked
Back to top
View user's profile Send private message
Hudzilla
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 265
Location: LXF Towers

PostPosted: Wed Jan 31, 2007 11:47 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast