473,405 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Need help with System.IO (C#) (C++, if you replace the -> with .)

brclancy111
Hello. I've been programming for 1 year now, and never saw this coming...
When I try to use
Expand|Select|Wrap|Line Numbers
  1. File.Exists("Data/Settings.dat")
it does absolutely nothing.

I am trying to build a system that automatically makes a file, if it doesn't exist, after it has been encoded.

Expand|Select|Wrap|Line Numbers
  1. string Settings = "";
  2.             string[] NewSettings = { "[BGM 10]", "[SFX 10]", "[ViewDistance 10]", "[Textures 10]", "[Lighting 5]", "[Shadows 5]", "[Gamma 0]", "[Sharpness 0]" };
  3.             string Encoded = EncodeSettings(NewSettings);
  4.             MessageBox.Show(Encoded);
  5.             if (File.Exists("Data/Settings.dat")) { Settings = System.IO.File.ReadAllText("Data/Settings.dat"); }
  6.             else
  7.             {
  8.                 File.WriteAllText("Data/Settings.dat", Encoded);
  9.             }
On every System.IO I use on my program will not write / Detect if the file exists.

No Debug window popped up.

P.S. this program happens to be a 1000+ Liner, so I cannot place the full thing here. If you're willing to try and read the 1000+, here it is
Feb 27 '08 #1
3 1265
ah..found the problem...the files were going into the drive folder instead of the wanted folder
Feb 27 '08 #2
Plater
7,872 Expert 4TB
I was going to suggest verifying that the files really do exist, as File.Exists() is usually pretty solid.
Feb 27 '08 #3
I was missing
Expand|Select|Wrap|Line Numbers
  1. System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
For the current folder.
Feb 27 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
22
by: Zeng | last post by:
Hi, I'm running ClrProfiler for the first time to profile my web app, and it keeps getting stuck at this msg box: "Waiting for Asp.net to start common language runtime - this is the time to load...
2
by: | last post by:
Hi, Im kindof new to c++... need a little help with system() function.. I use system to execute a dos program... but i want the rest of the program to continue imediately after executing it. and...
0
by: tvnaidu | last post by:
Porting windows app to Linux, can I replace windows "_mkdir" with system("mkdir") in Linux?. system("mkdir(...)");
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.