Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:57:18+00:00 2026-06-08T15:57:18+00:00

The following was given by my instructor and on my friends Win 7 it

  • 0

The following was given by my instructor and on my friends Win 7 it works just fine. I have tried my work laptop and my personal desktop…keeps finding the following error

I dont get it…I went as far as changing permissions to the directory to everyone just for kicks…it works on his copy paste but not mine.

“Could not find a part of the path ‘c:\Users\Wookie\My Documents\’.”

using System;
using System.IO;

class Program
{
 static void Main()
 {

 // This line of code gets the path to the My Documents Folder
 string environment = System.Environment.GetFolderPath
 (System.Environment.SpecialFolder.Personal) + "\\";

 Console.WriteLine("Enter a file name in My Documents: ");
 string input = Console.ReadLine();

 // concatenate the path to the file name
 string path = environment + input;

 // now we can use the full path to get the document
 StreamReader myFile = new StreamReader(path);
 int n = int.Parse(myFile.ReadLine());
 Console.WriteLine("read {0}", n);

 Console.ReadLine();
 }//End Main()
}//End class Program
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:57:25+00:00Added an answer on June 8, 2026 at 3:57 pm

    Try whether the file actually exists from your program’s point of view. Of course, replace yourfile.txt with the filename of the file you are looking for.

    string path = Path.Combine(System.Environment.GetFolderPath
        (System.Environment.SpecialFolder.Personal), "yourfile.txt");
    Console.WriteLine(File.Exists(path));
    

    If it doesn’t, try the same in your file system explorer. Otherwise, are you sure you’ve entered the file name correctly? Try hard-coding it temporarily. The above code also shows how you should combine paths (note the lack of a slash (\) as it is inserted automatically) and how to check whether a file (or directory, using Directory.Exists()) exists. This may be of use in finding where the problem is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to do the following: Given a vector with random numbers, separate it
I tried the following challenge: Given the first few factorials: 1! = 1 2!
Installing egit on indigo im given following options : I've just checked 'Eclipse Egit'
The following piece of code was given to us from our instructor so we
I have a class that distributes work given by the user to several threads.
consider the following situation: In order to have lots of work processed at my
I want to find out the following: given a date ( datetime object), what
I am trying to do some Cucumber testing like the following: Given I am
I'm looking for a solution to the following: Given today's date, figure out what
I want to override the tree_id field as following: Given: class Thing(MPTTModel): thing_id =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.