Linux(kubuntu) Problem

Tower Ty towerty at msn.com.au
Sat Mar 29 19:02:13 PDT 2008


> I added in additional error handling code to try and locate what was going on and found for certain that when using the void[] read(char[] filename) and void write(char[] filename, void*) functions that they don't do anything when not running my program from within the console or from within eclipse.
> 
> has anyone else had an error like this or should i be using different functions for read/write from the std.file module?

with Linux when an executeable does not do anything it may not have the correct permissions set . Could this be your problem here? Check executeable,owner and group are what you want.

You must be in the same directory as the executeable or have the $PATH set to where it is or and more . But explain what you mean by run in console and run in eclipse?

Here is some of the stuff I use

char[] input = cast(char[])File("number.int").read;

char[][] readFile() {
	auto content = cast(char[][]) File("outfile.txt").read;

void writeFile(char[][] content) {
  File output = new File ("outfile.txt");
	try{	
	output.write(content);
	Stdout("Successfully over-wrote to  file 'outfile.txt'").newline;}
	catch (AddressException xy){
	    Stdout("A file exception occured: " ~ xy.toString()).newline;}



  void writeNo(int docno) {
  File output = new File ("number.int");
	try{	
	void[] y = to!(char[])(docno);
	output.write(y);
	Stdout("Successfully over-wrote to  file 'number.int'").newline;}
	  catch (AddressException xy){
	    Stdout("A file exception occured: " ~ xy.toString()).newline;}
} 


More information about the Digitalmars-d-learn mailing list