[Dev-C++] Record of Pascal is struct here.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Dr. D. J. K. <din...@ea...> - 2001-12-23 19:27:42
|
Hey Exuss,
Yes C++ has all the facilities for you whatever you enjoyed in =
Pascal. (and much more).
Just use struct instead of record. see help available on the word =
struct.
Secondly when you want to output/input data to/from a file, you use out =
instead of cout. Of course, you have to first open your file for that. =
All this help is Ctrl+F1 away from you. Take your cursor in the IDE and =
press Ctrl+F1. (I hope you use proper IDE from Boreland.)
Remember only god and F2 Saves.
Dinesh Karia
To: dev...@li...
From: Exuss Draugas <dra...@ce...>
Reply-To: dra...@ce...
Date: Thu, 22 Nov 2001 19:18:51 +0100
Subject: [Dev-C++] Structured data in files
Hi!
Does anyone knows tutorial on the WEB, or could me explain, how to=20
use files in C++. In the books and tutorials information are only=20
about text files, something like:
ofstream myFile("file.txt");
myFile << "Some text";
But how to store/read structured data in files? In Turbo Pascal it=20
looks like:
{ Creating a record }
type human=3Drecord
name:string;
age:integer;
end;
var myFile:file of human; {file for storing records "human" type }
person:human;
person.name :=3D "GreatName";
person.age :=3D 100;
assign(myFile, 'peoples.hhh'); =20
rewrite(myFile);
write(myFile, person);
{ and so on .. } =20
=20
How to do the same in C++ ??=20
Thanks!
=20
Exuss
Interested in Topoligies? join: top...@ya...
Interested in Topological Algebras? Join: =
top...@ya...
For UGC Net Exam (To get help or to help) Join: =
ugc...@ya...
Are you Gujarati? Join a group of&by&for The Gujaratis =
guj...@ya...=20
Did you study at Sardar Patel University? Join =
spu...@ya...=20
|