ruby - File Shows error -


while inserting content file:

    file1=file.new("output.txt","w+")     puts "enter string"     in1=gets.chomp     if file1             file1.syswrite()     else         puts cant write     end     file1.close 

try this, uses write method on file class. remember when you're writing puts statement, succeeding string needs in quotes.

file1=file.new("output.txt","w+") puts "enter string" in1=gets.chomp if file1   file1.write(in1) else   puts "can't write" end file1.close 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -