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

  • SEARCH
  • Home
  • 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 8061847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:28:44+00:00 2026-06-05T10:28:44+00:00

EDIT: Due to random downvotes still coming in I guess I can clarify this

  • 0

EDIT:

Due to random downvotes still coming in I guess I can clarify this some more.

Essentially the question is asking how do you read from a text file in C#. The code i thought would work is below. The answer provides what actually works. Please comment when you downvote.

OLD:

I’m using Microsoft visual studios to write a video game, but can’t seem to get it to take in input from a text file. If i comment out the following line and and things based off of it, it works fine. If I add only this line back in then it runs but the window never pops up.

string[] allLines = File.ReadAllLines("map1.txt");

I also have the statement to be sure it is included.

using System;
using System.IO;

If you’d like more code I can post it but it’s a pretty large amount.

OLD-EDIT: To clarify, no window would pop up like it normally would when i ran my game but also no error messages would popup either. My txt file was included in the content but for some reason wasn’t working. I used the full path and now it works!

  • 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-05T10:28:45+00:00Added an answer on June 5, 2026 at 10:28 am

    I suggest using a fullpath here, as the file might not be in the place
    that your program is trying to read from (and hence you get a problem in reading it).

    string fullPath = @"C:\MyFantasticVideoGame\map.txt";
    string text = System.IO.File.ReadAllText(fullPath);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

THIRD EDIT: I now believe that this problem is due to a SOAP version
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT : It turned out that this can only be done through an external
Simple question - I'm trying to assign random values to some of my app's
edit: solved, sorry about this, was due to a typo. This code. List<Tuple<Int16, Int16>>
Edit (updated question) I have a simple C program: // it is not important
EDIT: Simple version of the question: I want to create server variables in the
EDIT: Due to the answer I change the code posted. I've added the Security.allowDomain(*)
EDIT Due to the overwhelming amount of advice I have received, I have fixed
I need some advice here, I hope somebody can help me. I have the

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.