diff options
Diffstat (limited to '659/CH12/EX12.1/exm12_1.sce')
-rwxr-xr-x | 659/CH12/EX12.1/exm12_1.sce | 24 |
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);
|