Ripes icon indicating copy to clipboard operation
Ripes copied to clipboard

Add example program for file I/O

Open mortbopet opened this issue 4 years ago • 12 comments
trafficstars

As indicated by #121, there should be an example program to demonstrate the use of the various file-related system calls. The example program could:

  • open a new file for writing
  • write something to the file
  • seeking in the file
  • closing the file
  • reopening the file and printing the contents of the file
  • ....

mortbopet avatar Sep 29 '21 12:09 mortbopet

Hi @mortbopet , let me introduce myself, my name is jakaria. I have a final project at my university. one of the topics in this final project is to contribute to solving the issues that exist in your project. I want to try to help you in this case. what I understand in this case you want to add a new various to the system call so that it can help the user if needed. here you want to add

  • open a new file for writing
  • write something to the file
  • seeking in the file
  • closing the file
  • reopening the file and printing the contents of the file can you explain more detail about it? what I know in the system call in this latest version only briefly describes a function. examples like PrintInt, PrintFloat, Exit... etc.

jakariaaa27 avatar Jan 05 '22 13:01 jakariaaa27

@mortbopet do you mean if we click "open" on the system call a dial dialog will appear showing, flag argument? then inside the dial dialog, we can write something inside the file and we can edit the dial dialog for everything?

jakariaaa27 avatar Jan 06 '22 05:01 jakariaaa27

Hey @jakariaaa27 - What is needed for this issue is an example assembly language program (like the others in file->load example->assembly->... which demonstrates the use of the file IO system calls. As i think you hinted to (and as hinted to by the original issue #121), the system call help dialog at help->system calls provides info of the available system calls ---including the file IO related ones--- but this might be a bit ambiguous for those who have not worked with low-level file APIs before.

In writing such an example assembly program, i would suggest you to first sketch out something in C where you also use the linux file API function like fstat, lseek, close and so forth, covering all of the file-related system. Once this C program works, you can then consider how to rewrite it in assembly using the system calls available in Ripes.

mortbopet avatar Jan 06 '22 07:01 mortbopet

are you expecting like --help to show the information of all system call and implement how these systems can be used and show the example?

jakariaaa27 avatar Jan 06 '22 15:01 jakariaaa27