-
May 8th, 2012, 12:08 PM
#1
Thread Starter
Fanatic Member
is c++ alright for writing vhd files
i have visual studio 6.0 if i buy c++ will it run with this and is there lots of people using it like vb6?
thanks
-
May 8th, 2012, 10:54 PM
#2
Re: is c++ alright for writing vhd files
VS6.0 is a suite that contains several language in series like, VB6, VC++6, VF6, etc... Why do you need to buy it separate ?
If you are moving to .Net, then try Visual Studio 2010. Or get the free Express versions of the languages from Microsoft's site.
Or, if you are a student, you might get the free Pro versions of these languages via DreamSpark initiative of Microsoft.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
May 9th, 2012, 05:20 AM
#3
Re: is c++ alright for writing vhd files
I believe the OP wants to work with VHD files (virtual hard drives).
Last edited by szlamany; May 9th, 2012 at 05:24 AM.
-
May 9th, 2012, 08:50 AM
#4
Re: is c++ alright for writing vhd files
Originally Posted by szlamany
I believe the OP wants to work with VHD files (virtual hard drives).
oops sorry !
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
May 9th, 2012, 09:14 AM
#5
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
never paid attention to the others time to start
-
May 9th, 2012, 11:49 AM
#6
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
ive been googling alot on how to make /create an vhd file ,what exactly do i look under to find more info?
thanks
-
May 9th, 2012, 12:36 PM
#7
Re: is c++ alright for writing vhd files
Just curious - you aren't trying to break into a VHD file - are you?
-
May 9th, 2012, 01:20 PM
#8
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
nope.
just strickly making one my self,i know theres tons of programs out there to do this ,i have some of them,just something i do to learn how it works and i like to do it myself , at least as much as i can...
-
May 9th, 2012, 01:31 PM
#9
Re: is c++ alright for writing vhd files
I searched up
VHD FILE FORMAT
This looks like a good link - with more links at the bottom
http://www.enotes.com/topic/VHD_(file_format)
-
May 9th, 2012, 09:52 PM
#10
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
hey msdn says the api for Virtual Hard Disk have to be running win 7 can it still be used in win xp?
-
May 11th, 2012, 12:42 PM
#11
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
hi
what does (cin) stand for?
how do i put my name and age in without having to prompt the user?
thanks
Code:
// prompt user to enter the new info
cout << "Set database info...\n";
cout << "Name: ";
cin.getline(per.name, 8);
cout << "Age: ";
(cin >> per.age).get();// add the .get() to clear the newline character
cout << "Salary: ";
(cin >> per.salary).get();// note .getline() clears its own newline character
// save the new user-entered data
if (SaveDB(&per))
cout << "\nDatabase saved!\n";
else
cout << "\nUnable to save database!\n";
// give the user a chance to look things over before quitting
cout << "\n[hit enter]";
cin.get();
// return 0 on success (main() should never be void!)
return 0;
-
May 11th, 2012, 01:01 PM
#12
Re: is c++ alright for writing vhd files
cin is for input operations(to read user inputs) and cout is for output operations(displaying on the screen)
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
May 11th, 2012, 01:18 PM
#13
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
Code:
do i have to use (char) letters and (int) for numbers?
// the data that will go into the database
struct Person {
char name[40];
int age;
float salary;
};
-
May 11th, 2012, 01:23 PM
#14
Re: is c++ alright for writing vhd files
char is the datatype for storing character. Inorder to store a string, you would use an array of characters(a string would contain a number of characters. So we are using array of char to store strings)
And int is to hold numbers within a specific range. It's of the range -32K to +32K I think. So you could store any values within that range in an int variable. Unsigned int would have a range of 0 to 64K. Just google it to know more.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
May 12th, 2012, 09:29 AM
#15
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
im getting an error at this line.
Person Per ;{
the error is
Code:
error C2447: '{' : missing function header (old-style formal list?)
am i doing something wrong
thanks
Code:
#include <fstream> // for ifstream, ofstream, ios_base
#include <iostream>// for cin, cout, endl
// you can just say `using namespace std;` here instead of all these 'using's
using std::ios_base;
using std::cout;
using std::cin;
using std::endl;
// just creating a constant for the name of the database
static const char *DATABASE_FILE = "pr1.bin";
// the data that will go into the database
struct Person {
char name[8];
int Features;
int FFVersion;
int DataOffset;
int TimeStamp;
char CreatorApplication[4];
int CreatorVersion;
int CreatorHostOS;
int OriginalSize;
int CurrentSize;
int DiskGeometry;
int DiskType;
int Checksum;
int UniqueId;
int SavedState;
//int Reserved;
};
Person Per ;{
name = williamc;
Features = 0000;
FFVersion = 0100;
DataOffset = FFFFFFFF;
TimeStamp = 1000;
CreatorApplication = wmc ;
CreatorVersion = 0100;
CreatorHostOS = Wi2k;
OriginalSize = 5243392;
CurrentSize = 5243392;
DiskGeometry = 00065535;
DiskType = 0002;
Checksum = 0512;
UniqueId = 1234567812345678;
SavedState = 1;
}
// this function takes a pointer to a Person struct
// that will be filled with the data in the file
bool LoadDB(Person *per) {
// first parameter is the name of the file
// second is the open flags.
// `in` says you will read from the file
// `binary` says you will read binary data instead of simple text
std::ifstream fin(DATABASE_FILE, ios_base::in | ios_base::binary);
// if we couldn't open the file (it may not exist); fail
if (!fin.is_open())
return false;
// the file is open; tell the read function to look at `per` as a
// char pointer instead of a Person pointer so that `fin` can place
// one byte at a time into the struct
// the second parameter tells read() how many bytes to read
// Note: do not use the ">>" operator to read from a binary file
fin.read((char*)per, sizeof(Person));
fin.close();// close the file - not necessary, but we should be neat
// success
return true;
}
// this function takes a pointer to a Person struct
// that will be written into the file
bool SaveDB(Person *per) {
// these flags say:
// `out` - we will be writing data into the file
// `binary` - we will be writing binary data and not simple text
// `trunc` - if the file already exists, truncate (wipe out) the existing data
std::ofstream fout(DATABASE_FILE, ios_base::out | ios_base::binary | ios_base::trunc);
// couldn't open it (disk error?); fail
if (!fout.is_open())
return false;
// notice this time we cast the Person pointer to a const char* because we aren't
// altering the structure this time; rather we're just looking at it's contents.
fout.write((const char*)per, sizeof(Person));
fout.close();// close the file - not necessary, but we should be neat
// success
return true;
}
int main() {
// create an empty person struct
Person per;
// load the data in the db file
if (LoadDB(&per)) {
// print what we loaded into our Person struct
cout << "Loaded Database...\n";
cout << "Name = " << per.name << endl;
cout << endl;
}
// save the new user-entered data
if (SaveDB(&per))
cout << "\nDatabase saved!\n";
else
cout << "\nUnable to save database!\n";
system("pause");
// return 0 on success (main() should never be void!)
return 0;
}
-
May 12th, 2012, 10:12 AM
#16
Re: is c++ alright for writing vhd files
This
Person Per ;{
should be this
Person Per {
I would believe...
-
May 12th, 2012, 02:38 PM
#17
Thread Starter
Fanatic Member
Re: is c++ alright for writing vhd files
nope tried that .
yall have a good mothers day
thanks all
-
May 12th, 2012, 10:55 PM
#18
Re: is c++ alright for writing vhd files
Try accessing it's member's using the dot on the object.
Example:
c++ Code:
Person Per ;
Per.name = "williamc";
Per.Features = 0000;
Per.FFVersion = 0100;
Per.DataOffset = FFFFFFFF;
//...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|