summaryrefslogtreecommitdiff
path: root/659/CH12/EX12.1/exm12_1.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /659/CH12/EX12.1/exm12_1.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '659/CH12/EX12.1/exm12_1.sce')
-rwxr-xr-x659/CH12/EX12.1/exm12_1.sce24
1 files changed, 24 insertions, 0 deletions
diff --git a/659/CH12/EX12.1/exm12_1.sce b/659/CH12/EX12.1/exm12_1.sce
new file mode 100755
index 000000000..c5ab08b6a
--- /dev/null
+++ b/659/CH12/EX12.1/exm12_1.sce
@@ -0,0 +1,24 @@
+// Example 12.1
+// Write a program to read data from keyboard,write it to a file called INPUT,
+// again read the same data from the INPUT file and display it on the screen.
+
+warning('off');
+disp("Data Input");
+
+//Open the file INPUT
+f1=mopen('INPUT.txt','w');
+// Get character from keyboard
+c=read(%io(1),1,1,'(a)');
+mfprintf(f1,'%s',c);
+
+//close the file input
+mclose(f1);
+
+
+disp("Data Output");
+//Reopen the file INPUT
+f1=mopen('INPUT.txt','r');
+ txt=mgetl(f1);
+ printf("%s",text);
+//close the file input
+mclose(f1);