0

I have installed visual c++ 2008 few days ago.
I want to create a file open it, display contents, modify them and search them but i dont know specific codes.
I have used turbo c++ earlier.
Please specify the codes if possible. Thanx............;)

4
Contributors
12
Replies
13
Views
8 Years
Discussion Span
Last Post by 13L4D3
0

You could probably use something like this read and create a file.
ofstream used for creating and write to file.
ifstream used for reading from file.

#include <iostream>
#include <fstream>

ofstream File1;
File1.open("C:\\Createdfile.txt");

File1 << "This is written to File1";

Read a file:

ifstream File2("C:\\Createdfile.txt");
std::string GetTheLine;

while( getline(File2, GetTheLine, '\n') )
{
}

I have installed visual c++ 2008 few days ago.
I want to create a file open it, display contents, modify them and search them but i dont know specific codes.
I have used turbo c++ earlier.
Please specify the codes if possible. Thanx............;)

0

Go back to the Microsoft site where you got that compiler and it will have link(s) to tutorial(s) about how to use the IDE. It takes a little practice, but you should bet the basics right away. Just remember, VC++ 2008 Express is NOT Turbo C++, so don't expect to use it the same way. With VC++ 2008 Express (or any other 32-bit compiler) you don't have to worry about segments, memory models, NEAR or FAR pointers, 640K barrier or any other of those limitations found in Turbo C++. You will also notice from the previously posted code that STL header files do not have .h extension. Those are the new and improved versions that Turbo C++ does not support.

-1

#include <iostream>
#include <fstream>

I really doesn't argree with you using the standard libs . Go to the M$ web site and find
out the win32 api calls that what are the APIS that used to write to a file and read from a file
. But if this is your learning c++ using the visual studio c++ , then this is not a good comment for you .

If you know c++ and you need to learn something deeper then go and learn it .If you learning
C++ ( that means that you don't know the core c++ ) then use the iostream.h include file.

and get sharp with that and come again to here and learn what I above said .

Comments
Looks like you need to educate yourself.
0

I really doesn't argree with you using the standard libs .

When just starting to learn the c++ language always always use standard c++ set of STL and other header files/streams. They are portable to any modern c++ compiler on any operating system, and there are hundreds of books that teach them too. He's trying to learn c++, not win32 api.

.If you learning C++ ( that means that you don't know the core c++ ) then use the iostream.h include file.

That's like advising a teenager to learn to drive a car by riding horse-and-buggy. iostream.h never was and is not now part of the c++ standards, and went out of style probably over 10 years ago. Your advise is just so much rubbish.

0

When just starting to learn the c++ language always always use standard c++ set of STL and other header files/streams. They are portable to any modern c++ compiler on any operating system, and there are hundreds of books that teach them too. He's trying to learn c++, not win32 api.

That's like advising a teenager to learn to drive a car by riding horse-and-buggy. iostream.h never was and is not now part of the c++ standards, and went out of style probably over 10 years ago. Your advise is just so much rubbish.

I too agree with ancient dragon. As i have already told in this thread that i knew basics about c++ as i have already worked on turbo version and now want to go in depth knowledge. So it was really a bad post sanzilla.
Thanx Ancient Dragon and jennifer84 for your advices...................

0

I have used turbo c++ earlier.

then I thought that you already knew the core c++ programming language .

true what they saying , I agree with the Ancient Dragon , but what is your problem man . Common ,

he said that ,

When just starting to learn the c++ language always always use standard c++ set of STL and other header files/streams. They are portable to any modern c++ compiler on any operating system, and there are hundreds of books that teach them too. He's trying to learn c++, not win32 api.

Then he means that if you new to the c++ use the stdlibs and not new use that apis .
then that is what I also said you . Yes he is correct , he said that STL is better to learn , yes I also agree with that , we cannot say that the STL is not used in the industry .

13L4D3 , so then sorry about the post ,

0

then I thought that you already knew the core c++ programming language .
true what they saying , I agree with the Ancient Dragon , but what is your problem man . Common

actually m new to visual c++ there are lots of stuffs to know. So was asking for the basics one.
Bcoz i have already made a program on turbo version and now m tryin to make it with help of visual c++, so i needed help in order to carry on with ma work.........

13L4D3 , so then sorry about the post.

There is nothing to say sorry about, but if u cud help me out i will really be thankfull to u.

0

ok , here I think I can help you again.
you said

actually m new to visual c++

My comment is the C++ is a language , and that language syntax is not dependent on the compiler or the IDE that you are using . It may be MSVC++ , Turbo C++ , gnu c++ does not matter. So to learn the basics of the C++ programming language I use this book our Brucle uncle.and he not dependent on the STL . and I say you again this is not the place to learn STL .
there are many books on STL as Drag... said.

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

sorry for uncle , actually my jedi master . may be I am the anaken skywalker!

0

There is nothing to say sorry about, but if u cud help me out i will really be thankfull to u.

Go back and reread the first two or three posts to this thread -- your question has already been answered. Its up to you to study and test them out ... we can't do that for you.

0

Go back and reread the first two or three posts to this thread -- your question has already been answered. Its up to you to study and test them out ... we can't do that for you.

Yes i have read them all and tried to connect the .mdb file for a start by downloading Northwind Trader Sample Database but was wrong somewhere so have to try again n again well thanx for ur help..........

0

If you want help then you will have to post code. I'm getting old and my eyes can't see as good as they used to so I can't see your monitor from where I'm sitting. I never owned a crystle ball either. :)

0

If you want help then you will have to post code. I'm getting old and my eyes can't see as good as they used to so I can't see your monitor from where I'm sitting. I never owned a crystle ball either. :)

hahahaha..........
thanx for ur concern but m not yet done with checking that one so when i will need help i will surely inform u guyz and yes will give code thanx...........:-/

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.