Why is access to the path denied?

I am having a problem where I am trying to delete my file but I get an exception. if (result == “Success”) { if (FileUpload.HasFile) { try { File.Delete(Request.PhysicalApplicationPath + app_settings.login_images + txtUploadStatus.Text); string filename = Path.GetFileName(btnFileUpload.FileName); btnFileUpload.SaveAs(Request.PhysicalApplicationPath + app_settings.login_images + filename); } catch (Exception ex) { Message(ex.ToString()); } } } Also I should note … Read more

How to create a file in Ruby

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.txt” File.new “out.txt”,”w” File.open “out.txt”,”w” According to everything I’ve read online all of those should work but every single one of them gives me this: ERRNO::ENOENT: No such file … Read more

Do I need to close() both FileReader and BufferedReader?

I’m reading a local file using a BufferedReader wrapped around a FileReader: BufferedReader reader = new BufferedReader(new FileReader(fileName)); // read the file // (error handling snipped) reader.close(); Do I need to close() the FileReader as well, or will the wrapper handle that? I’ve seen code where people do something like this: FileReader fReader = new … Read more

cout is not a member of std

I’m practicing using mulitple files and header files etc. So I have this project which takes two numbers and then adds them. Pretty simple. Here are my files: main.cpp #include <iostream> #include “add.h” int main() { int x = readNumber(); int y = readNumber(); writeAnswer(x + y); return(0); } io.cpp int readNumber() { int x; … Read more