Hi, can someone tell me some tutorial (if possible source code included) where you can learn to make a program to read and write a file in Visual C 2008?
Thanks a lot.
Read/Write Visual C++
Page 1 of 14 Replies - 3096 Views - Last Post: 10 December 2010 - 06:34 AM
Replies To: Read/Write Visual C++
#2
Re: Read/Write Visual C++
Posted 10 December 2010 - 02:10 AM
Read and enjoy
http://www.cprogramm...c/lesson10.html
EDIT
The above is for C (as per the body of your post)
This is for C++ (as per the heading of your post)
http://www.cplusplus...tutorial/files/
You do have to be very clear which language you are asking for help with.
C and C++ are different languages.
You need to be precise and pay careful attention to detail to be a programmer.
http://www.cprogramm...c/lesson10.html
EDIT
The above is for C (as per the body of your post)
This is for C++ (as per the heading of your post)
http://www.cplusplus...tutorial/files/
You do have to be very clear which language you are asking for help with.
C and C++ are different languages.
You need to be precise and pay careful attention to detail to be a programmer.
This post has been edited by janotte: 10 December 2010 - 02:37 AM
#3
Re: Read/Write Visual C++
Posted 10 December 2010 - 05:20 AM
janotte, on 10 December 2010 - 09:10 AM, said:
Read and enjoy
http://www.cprogramm...c/lesson10.html
EDIT
The above is for C (as per the body of your post)
This is for C++ (as per the heading of your post)
http://www.cplusplus...tutorial/files/
You do have to be very clear which language you are asking for help with.
C and C++ are different languages.
You need to be precise and pay careful attention to detail to be a programmer.
http://www.cprogramm...c/lesson10.html
EDIT
The above is for C (as per the body of your post)
This is for C++ (as per the heading of your post)
http://www.cplusplus...tutorial/files/
You do have to be very clear which language you are asking for help with.
C and C++ are different languages.
You need to be precise and pay careful attention to detail to be a programmer.
Sorry Janotte, It is for Visual C++ 2008, It's fault of my dark side
Thanks for the reply, but what I want to know is how to distribute that source code in Visual C++ to do the same but in a window. I want to learn how I can do a GUI for that code. I don't kwow If I explain.
#5
Re: Read/Write Visual C++
Posted 10 December 2010 - 06:34 AM
I have this code
In C++, I sent each line to a save function with a string and then, modify the line before saving. But in Visual C++ I'm lost, I don't know how to do that in the above code. Only read a txt file, modify line by line and save line by line.
Thank you for your guidance
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Stream^ myStream;
string completo, parte1, parte2, parte3, parte4;
OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
openFileDialog1->InitialDirectory = "c:\\";
openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1->FilterIndex = 2;
openFileDialog1->RestoreDirectory = true;
if ( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK )
{
if ( (myStream = openFileDialog1->OpenFile()) != nullptr )
{
}
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
Stream^ myStream;
SaveFileDialog^ saveFileDialog1 = gcnew SaveFileDialog;
saveFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1->FilterIndex = 2;
saveFileDialog1->RestoreDirectory = true;
if ( saveFileDialog1->ShowDialog() == ::DialogResult::OK )
{
if ( (myStream = saveFileDialog1->OpenFile()) != nullptr )
{
// Code to write the stream goes here.
myStream->Close();
}
}
In C++, I sent each line to a save function with a string and then, modify the line before saving. But in Visual C++ I'm lost, I don't know how to do that in the above code. Only read a txt file, modify line by line and save line by line.
Thank you for your guidance
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|