TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhinav Mehta
NA
36
12.5k
Reading characters from stream of file
Mar 24 2011 5:03 PM
I have a text file created to a certain path.
The contents of the text file are as follow:
%
G70
G91
X.5Y-.5
G97
G41
M04
I want to edit this text file and remove certain characters for eg. a "%" sign from the file. Following is the code I implemented but it has no effect. I think it is unable to read individual line or may be it just closes the file after reading from top to bottom. Please advice:
try
{
using (StreamReader Gcode = new StreamReader(path))
{
string line;
while ((line = Gcode.ReadLine()) != null)
{
foreach (string line2 in File.ReadAllLines(path))
{
if (line2.Contains("%"))
{
line2.Replace("%", "");
}
}
}
}
}
Reply
Answers (
33
)
how to using printer to print report
Problem with Regular Expressions