How to create a file in Ruby

后端 未结 9 1319
再見小時候
再見小時候 2020-11-28 18:04

I\'m trying to create a new file and things don\'t seem to be working as I expect them too. Here\'s what I\'ve tried:

File.new \"out.txt\"
File.open \"out.tx         


        
9条回答
  •  甜味超标
    2020-11-28 18:47

    OK, now I feel stupid. The first two definitely do not work but the second two do. Not sure how I convinced my self that I had tried them. Sorry for wasting everyone's time.

    In case this helps anyone else, this can occur when you are trying to make a new file in a directory that does not exist.

提交回复
热议问题