开发者

In ruby am unable to open a text file from a specified location, where as am able to open a file which I have created on my own

开发者 https://www.devze.com 2023-03-20 17:24 出处:网络
I have a file which is placed in C:\\mtn-2\\mtn-2.2\\logs\\messages.txt, if am trying to open this file via script it says no such file or directory, so I have created another file called a.txt in the

I have a file which is placed in C:\mtn-2\mtn-2.2\logs\messages.txt, if am trying to open this file via script it says no such file or directory, so I have created another file called a.txt in the same location and tried to open via ruby script its working file. messages.txt file am able to rename/modify manually but the same it not working through the script. Am working on windows xp.

The code which I have written is :开发者_如何转开发

f=File.open("C://mtn-2//mtn-2.2//logs//messages.txt", "r") // not working, this is created by some tool,     
f=File.open("C://mtn-2//mtn-2.2//logs//a.txt", "r")  // its woking, this is created by me.

Waiting for your early reply


The messages.txt file should be closed before it is opened by your program for reading.

0

精彩评论

暂无评论...
验证码 换一张
取 消