CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Cannot create a file?

    Hello.... I have code which reads/writes fine to a file but if the file does not exist it throws filenotfoundexception... OK how can I create the file?

    Thanks in advance ... really appreciate the help...



  2. #2
    Guest

    Re: Cannot create a file?

    Where is the code?
    Anyway.
    To create a file simply do this
    To read from existing file

    File f = new File("filename"); //if doesn't exist, it'll be created automatically
    FileInpustream fis = new FileInputStream(f);

    to write to file create FileOutputStream instead.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured