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
beginner
NA
3
0
syntax to modify code from vc++.net to c#.net
Oct 11 2007 3:47 AM
Hi,
Earlier i was working with VC++.net code to read contents of a file & copy it to another file. Now i want to perform the same task using c#.net. pls help me.. The code in vc++.net was
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
String^ s;
FileStream ^stmGrades = gcnew FileStream("CFG.txt",FileMode::Create, FileAccess::Write);
StreamWriter ^bnwGrades = gcnew StreamWriter(stmGrades);
// Create a FileInfo object based on the file
FileInfo ^fleLoan = gcnew FileInfo(openFileDialog1->FileName);
// Open the file
StreamReader ^stmLoan = fleLoan->OpenText();
//Read each line in the selected file & assign/store that line to string pointer s till null or EOF is reached
while(s = stmLoan->ReadLine()) // THIS LINE I WANT TO MODIFY TO C#
{
bnwGrades->WriteLine(); //write the line in the created file
}
}
stmLoan->Close();
bnwGrades->Close();
}
Reply
Answers (
4
)
Incremental backup of a file
NP52 Two objTwo = Two.New();