+ 3

W+ mode is not working why ?

I am using File.open ("filename","w+") but its does not showing anything when i replaced w+ with r its working. can you tell me why?

2nd Nov 2017, 5:27 PM
~Sudo Bash
~Sudo Bash - avatar
4 Réponses
+ 7
Well, you open a file for writing if you want to create it and/or add data to it. And you open a file for reading, if you just want to read the data from it. You can't do both at the same time to one file (most applications create a virtual copy when working on a file in a more user-friendly way).
3rd Nov 2017, 12:07 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 7
w+ is for writing, not "showing" (reading). It expects you to write something to the file.
2nd Nov 2017, 5:42 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
so what is reading and writing mode ?
3rd Nov 2017, 9:46 AM
~Sudo Bash
~Sudo Bash - avatar
0
file.open("filename",iOS::in|iOS::out)
3rd Nov 2017, 12:37 PM
Talluri Saisumanth
Talluri Saisumanth - avatar