Tuesday, 4 December 2012

File Handling in DAX 2012

Writing to a Text File

static void textFileWrite(Args _args)

{

TextBuffer tb = new TextBuffer();

;

tb.appendText(“Hello World!”);

tb.appendText(“\nWelcome to MIT”);

tb.appendText(“\nHyderabad”);

tb.toFile(“c:\\Sample.txt”);

}

Reading from a Text File

static void textFileRead(Args _args)

{

TextBuffer tb = new TextBuffer();

;

if(WinApi::fileExists(“c:\\Sample.txt”))

{

tb.fromFile(“c:\\Sample.txt”);

info(tb.getText());

}

else

{

info(“No file exists”);

}

}

No comments:

Post a Comment