Answers for "how to create a file and write in the file in kotlin"

1

write to file kotlin

val file:String = fileName.text.toString()  
val data:String = fileData.text.toString()  
val fileOutputStream:FileOutputStream  
try {  
    fileOutputStream = openFileOutput(file, Context.MODE_PRIVATE)  
    fileOutputStream.write(data.toByteArray())  
}catch (e: Exception){  
    e.printStackTrace()  
}
Posted by: Guest on November-15-2021

Code answers related to "how to create a file and write in the file in kotlin"

Browse Popular Code Answers by Language