Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

rubyÎļþ²Ù×÷

1¡¢ÎļþµÄ´ò¿ªÓë¹Ø±Õ
    ``r'' Read-only, starts at beginning of file (default mode).
    ``r+'' Read-write, starts at beginning of file.
    ``w'' Write-only, truncates existing file to zero length or creates a new file for writing.
    ``w+'' Read-write, truncates existing file to zero length or creates a new file for reading and writing.
    ``a'' Write-only, starts at end of file if file exists, otherwise creates a new file for writing.
    ``a+'' Read-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.
    ``b'' (DOS/Windows only) Binary file mode (may appear with any of the key letters listed above).
     ʹÓÃfile.new·½·¨»ñÈ¡Ò»¸öÎļþ¾ä±úÀ´¶ÔÎļþ²Ù×÷£¬²Ù×÷½áÊøºófile.closeÀ´¹Ø±ÕÎļþ¡£
     file.open·½·¨ÊÇnew·½·¨µÄÀ©³ä£¬¸Ã·½·¨¿ÉÓдúÂë¿é£¬¸Ã´úÂë¿é½áÊøºó×Ô¶¯close£¬¶øÇÒÔÚ²Ù×÷¹ý³ÌÖз¢Éú´íÎóʱÄܹ»×Ô¶¯ÊÕ¼¯´íÎó²¢ÍƳö
    Èç    
    file.open("filepath") do |file|
        file.each do |line| ... end
    end
    һЩÎļþµÄ³£ÓÃÃüÁ
    File.open(dir+"/read.txt","w") do |file|
    file.puts("djkjsadlkjdkdsfdsee")
end puts File.exists?(dir+"/read.txt")       ÎļþÊÇ·ñ´æÔÚ
puts File.directory?(dir+"/read.txt")    ÎļþÊÇ·ñÊÇĿ¼·¾¶
puts File.file?(dir+"/read.txt")        ÊÇ·ñÊÇÎļþ
puts File.zero?(dir+"/read.txt")        ÎļþÄÚÈݳ¤¶ÈÊÇ·ñΪ0
puts File.size(dir+"/read.txt")        »ñÈ¡Îļþ´óС
put


Ïà¹ØÎĵµ£º

Ruby¸ßÊÖµãÆÀScala±à³ÌÓïÑÔ

<תÔØ>
¡ôScala µÄÈ·ºÜ°ô¡£
¡ôÎÒµÄÈ·ÈÏΪ¼ÆËã»úѧԺӦ¸Ã¿ªÒ»ÃÅ Scala µÄÓïÑԿγ̡£
ÔÚÕâƪÎÄÕÂÖУ¬ÎһὲÊöΪʲôÎÒ»áÓÐÕâÑùµÄÏë·¨£¬ÔÚ´Ë֮ǰ£¬Óм¸µãÎÒÏëÒªÏÈÉùÃ÷һϣº
±¾ÎÄÎÞÒâ¶Ô±à³ÌÓïÑÔ½øÐÐÆÀ±È£¬ÎÒÒª½²ÊöµÄÖ÷ÌåÊÇΪʲôÄãÓ¦¸Ãѧϰ Scala¡£51CTO֮ǰÔø·¢²¼¹ýһƪ Java ³ÌÐòԱΪºÎҪѧϰScalaµÄÎÄÕ£¬¿ÉÄÜÒ²» ......

ruby Ó¦ÓÃ

1£ºFXRuby is a library for developing powerful and sophisticated cross-platform graphical user interfaces (GUIs) for your Ruby applications. It¡¯s based on the FOX Toolkit, a popular open source C++ library developed by Jeroen van der Zijp. What that means for you as an application developer is that ......

RUBY ʵÏÖSOAP

SOAP ·þÎñ¶Ë£º
#!/usr/local/bin/ruby
require 'soap/rpc/standaloneServer'
module MySOAP
 class Timer
  def now
   Time.new.strftime("%Y-%m-%d %H:%M:%S")
  end
 end
 class Add
   def add(i, j)
  return i.to_i + j.to_i
&nb ......

rubyµü´úÆ÷»ù´¡

“Ñ­»·”»áÓÃÔÚ³ÌÐòÖеĸ÷Öֵط½¡£¶øÔÚÑ­»·µÄµØ·½ÉÆÓÓµü´úÆ÷”£¬ÔòÊÇÊìÁ·½øÐÐRuby³ÌÐòÉè¼ÆµÄÖØÒª¹Ø¼ü¡£
²»¹ý£¬µü´úÆ÷ȷʵÓбȽϳéÏóµÄµØ·½£¬Óï·¨Ò²Óеã¹ÖÒ죨ÓÈÆäÊÇyieldµÄÓ÷¨£©£¬¹âÊÇÒÀ¿¿ÎÄ×Ö˵Ã÷¡¢¿´Ò»Á½¸öʾÀý£¬»¹ÊDz»Ì«ºÃ¶®¡£Æäʵ£¬µ±³õ±ÊÕß¿ªÊ¼Ñ§Ï°Rubyʱ¾Í¿¨ÔÚÕâÀºÜ¾Ã¶¼¸ã²»¶®¡£
ËùÒÔÔÚ± ......

Çå³þVSSÎļþµÄÅú´¦Àí(Ruby°æ)

 
def delVss(path)
  if File.directory?(path)
    for f in d = Dir.open(path)
        fpath = File.join(path, f) 
      if(f!="."&&f!="..")      
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ