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 5975283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:03:46+00:00 2026-05-22T21:03:46+00:00

I have a little problem. Let me explain the workplace. My Text File Structure:

  • 0

I have a little problem. Let me explain the workplace.

My Text File Structure:
X_OFFSET 0
Y_OFFSET 0
IDSTART
0001 222 222 222 222
0002 250 500 250
0003 1700 500 500 250
0004 900 600 500 250
0005 1350 250 500 250
IDEND

What I must do is to find the IDSTART-IDEND block and DELETE a spesific line between them.

Example: User set id1 123 124 125 126 => id1 means ID, 123 means Center X, 124 means Center Y, 125 means Center Z and 126 means Radius.

Workplace:
The user will enter the id number(such as id5) to a text box, then click a button to delete the whole line starting with “id5″…

is this possible? if it is, How can I make it?

[Improved_v2]

Okey, I’ve made some changes and it works now. But, there is problem.

FileStream fs = new FileStream(“C:\hucre.txt”, FileMode.Open);
StreamReader okuma = new StreamReader(fs);
string Metin = okuma.ReadToEnd();
char[] Ayrac = { ‘\n’ };
MetinSplit = Metin.Split(Ayrac);

    for (int i = 0; i < MetinSplit.Length; i++)
    {
        GeciciDizi.Add("a");
        GeciciDizi2.Add("b");
    }
    // MetinSplit'i GeciciDiziye At.
    for (int i = 0; i < MetinSplit.Length; i++)
    {
        GeciciDizi[i] = MetinSplit[i];
    }

    for (int i = 0; i < MetinSplit.Length; i++)
    {
        GeciciDizi2[i] = MetinSplit[i];
    }

    for (int i = 0; i < GeciciDizi.Count; i++)
    {
        if((string)GeciciDizi[i]==SilinecekDeger)
            GeciciDizi.RemoveAt(i);
    }
    for (int i = 0; i < GeciciDizi.Count; i++)
    {
        GeciciDizi2[i] = GeciciDizi[i];
    }

    okuma.Close(); 
    fs.Close();
    FileStream newFile = new FileStream("C:\\hucretemp.txt",      FileMode.Open);

    StreamWriter yaz = new StreamWriter(newFile);
    for (int i = 0; i < GeciciDizi2.Count; i++)
    {
        yaz.WriteLine(GeciciDizi2[i]);
    }

    yaz.Close();
    yeniFile.Close();
    File.Delete("C:\\hucre.txt");

    File.Move(@"C:\\hucretemp.txt",   @"C:\\hucre.txt");
}

}

Here, the problem is this.

When I read from the file hucre.txt to my tempArrayList, it wrtes to array like this below.

X_OFFSET 0\r\n
Y_OFFSET 0\r\n
IDSTART\r\n
0001 222 222 222 222\r\n
0002 250 500 250\r\n
0003 1700 500 500 250\r\n
0004 900 600 500 250\r\n
0005 1350 250 500 250\r\n
IDEND

it adds one more \r.

So, when I want to read something from the “hucre.txt”,
I can’t managed to do it, because
it becomes like this 0001 222 222 222 222*\r\r\n*

How can I remove it?

I really am desperate, please help :/

My best regards…

  • 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-05-22T21:03:47+00:00Added an answer on May 22, 2026 at 9:03 pm

    I didn’t read through all your code, but your I/O logic is way to complicated and inefficient.

    Basic idea:

    using (var reader = File.OpenText(orgFileName))
    using (var writer = File.CreateText(tmpFileName))
    {
        while (true)
        {
           string line = reader.ReadLine();
           if (line == null)
             break; // done
    
           // logic to analyze / track content
    
           if ( Is_special_line)
           {
              // do something, or maybe nothing (skip)
           }
           else
           {
              writer.WriteLine(line);
           }
        }
    }
    
    File.Delete(orgFilename);
    File.Rename(tmpFilename, orgFilename);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hallo all. I have a little problem. I have a function. Let’s call it
So, here is my little problem. Let's say I have a list of buckets
I have a little problem with MVVM. Let me first sketch my problem. I
I have a little problem with elFinder. I'll try to explain the best I
I have a little problem with a FileReference which I use to let users
I still have a little problem grasping the concept of pure OOD. Let's say
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have a little problem with a Listview. I can load it with listview
I have a little problem with a simple vbScript. The script has to run
I have a little problem with some jquery and http://www.mikage.to/jquery/jquery_history_noc.html The function works great,

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.