Skip to content
Snippets Groups Projects
Commit 83aa282d authored by Abhay Menon's avatar Abhay Menon
Browse files

Merge branch 'File-management-for-console-app' into 'main'

File management non printing bug has been fixed

See merge request !7
parents 1d676682 09fb2b97
No related branches found
No related tags found
1 merge request!7File management non printing bug has been fixed
Pipeline #83488 passed with stages
in 3 minutes and 1 second
......@@ -10,4 +10,5 @@ fun main() {
val f = Filemanager("${System.getProperty("user.dir")}/test/", "hello.txt")
f.writefile("hello world")
println(f.openfile())
f.deletefile()
}
hello world
\ No newline at end of file
......@@ -24,6 +24,7 @@ class Filemanager(private val dir: String, private val name: String) {
// create and write to that file
fun writefile(line:String) {
filepath.writeText(line)
listfiles.add(filepath)
}
// opens and read the existing file
......@@ -37,6 +38,7 @@ class Filemanager(private val dir: String, private val name: String) {
}
fun deletefile():Boolean {
listfiles.remove(filepath)
return filepath.delete()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment