Copy data from one file to another through X++:

Hi,
To copy data from one file to another file.

static void MyServerFunction(args _args)
{
Filename filename =”D:\\hi.txt”;
TextBuffer txtb = new TextBuffer();
FileIOPermission fileIOPermission = new fileIOPermission(filename,’rw’);
Filename f = “D:\\bye.txt”;
;

fileIOPermission.assert();
// From file will demand CAS permission (read)
txtb.fromFile(filename); // Read text from file
// To clipboard will demand CAS permission (write)
txtb.toClipboard(); // Copy it to the clipboard
// To file will demand CAS permission (write)
txtb.toFile(f); // Write text to file
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s