Tuesday, July 17, 2018

managed to write a file from terminal input - Rust

My Text editor program in Rust programming language managed to get input characters from screen terminal as created a file once program ends.

Read the code here
https://github.com/davnav/RustEditor/blob/master/main.rs


If I started writing this in C, i would have end up in "Segmentation fault". But even though Rust compiler makes you learn the syntax and new concepts ( mutation,scope,borrow etc) . But once we managed to compile the code, the program produces the output as we expected.(won't go to the buffer overflows or pointer problems)

Terminal is not pointing to left most position when I hit enter, looks like I need to handle this manually.




I have not build any 'struct' for 'Editor' or 'Rows'. Not sure much syntax for 'struct' in Rust.  Reading more this now.


 I think I can move to the 'text viewer' pages in the below documentation.
https://viewsourcecode.org/snaptoken/kilo/04.aTextViewer.html

No comments: