|
A union is essentially a structure in which all of the fields overlay each other; you can only use one field at a time. But that's not the case with structures. In structures fields don't overlay each other and any field can be used any time.
The size of a union is the maximum of the sizes of its individual members, while the size of a structure is the sum of the sizes of its members.
Nibu thomas
Software Developer
|
|
|
|
|
Each field of a union starts at the same location in memory, whereas each field in a structure gets separate memory locations.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Just to explain so that you can get a clear view of what the difference is:
suppose we have a structure
struct abc
{
int a;
char b;
}a1;
When you try to use the sizeof operator on this, the value will be correctly printed as int of size 2bytes and a char value of 1 byte .
The total size of the structure would thus be 3
On the other hand if you use unions and declare it as
union def{
int a;
char ch;
}u1;
Then the size of operator will show 2. As the memory of variables in a union is shared and the size is of the highest occupant in the union.
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
AnShUmAn_VCPP wrote: When you try to use the sizeof operator on this, the value will be correctly printed as int of size 2bytes...
I think you mean 4 bytes.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
yes . The value that will be shown is compiler dependent.
If you work on turbo c you will get 2
if you work on visula studio you will get the size of an int in this case
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
AnShUmAn_VCPP wrote: If you work on turbo c you will get 2
But this is a Visual C++ forum...
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi, i am developing a project to take backup of a partition of a disk. I want to
know how to take incremental(backup of only those sectors which are changed after the first backup). Please help.
Thanks.
|
|
|
|
|
I'm not aware of any such markings on the sector level. Files and folders have an archive bit that gets set when the file has been changed, and most good backup programs will turn this bit off after it has successfully archived the file.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
How I copy a file from my local machine to a webserver. How can i create a new folder in the web server on a particular Virtual directory? Please share code to copy/write file in web directory using a URL as destination folder?
the target location to copy file is like "http://www.abc.com/DestFolder/" n Some cases i need to create new folder in the DestFolder also..
Please help
|
|
|
|
|
try with ISAPI concepts by getting Web server extensions.
pls. go thru
http://www.codeproject.com/ISAPI
Rgds
Vivek Subramanian
viveks
|
|
|
|
|
anilFirst wrote:
How I copy a file from my local machine to a webserver.
You can use HTTP or FTP for this. The Web server has to be configured to accept files, however.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
How to hide standard toolbar in my simple appliation by default?
When I run my application it is showing the standard toolbar and status bar. at first time I like to hide these 2. After my selection in menu then only these toolbars should be appear. how to make it. Thanks.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Just remove the WS_VISIBLE style during creation of the toolbar inside the OnCreate function.
Nibu thomas
Software Developer
|
|
|
|
|
Ya. Working. Thanks.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Hi,
Use ShowControlBar()
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I declare a Command like this :
CCommand<caccessor
<cdboarticle1accessor> >tabmiki; and I open it like this :
hr = tabmiki.Open(session, "SELECT * FROM article1 ", NULL);
And in my form I put to buttons(NEXT, and Previous) in side I write tabmiki.movenext() and tabmiki.moveprev().
movenext() works but moveprev() don't works, I don't know why
Can you help me ?
I learn my self
-- modified at 0:59 Wednesday 1st March, 2006
|
|
|
|
|
What is CdboARTICLE1Accessor ?
mikobi wrote: Can you help me ?
Probably not, since you failed to provide anything useful. You need to set a breakpoint in the moveprev() method and then single-step through it until you find the statement(s) that does not work. Otherwise, it could be any number of things, and you'll end up "chasing a rabbit" as a result.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I am using SQL SERVER 2000 as database;
CdboARTICLE1ACcesor is an Class Accesor i generate from ARTICLE1 table.
|
|
|
|
|
I dont know how to connect with SQL server 2000 and retrive the data?
i belive that u can help me.
thanks in advance
JAYARAJ
|
|
|
|
|
To retrieve data from SQL SERVER, make first an Accessor.Do that in your project workspace:
Click on Insert -> New ATL Object; in catégories choice Data Access->Consumer from here enter the name of your database; password;choice command and click on ok after choice the table you want to access, click in ok again.
Here a Class Accessor is generate.
Now in your event write this code :
bool bsavevalidation = true;
CWnd::UpdateData(bsavevalidation);
HRESULT hr;
CDataSource db;
CDBPropSet dbinit(DBPROPSET_DBINIT);
CString strItem;
int k = 0;
CSession session;
CString strCommand,strSql;
dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR("yhwha"));
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("sa"));
dbinit.AddProperty(DBPROP_INIT_CATALOG, OLESTR("STOCK"));
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, databas);
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1036);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
hr = db.Open(_T("SQLOLEDB.1"), &dbinit);
if (FAILED(hr))
{
AfxMessageBox("impossible d'ouvrir la baseo");
}
else
{
hr = session.Open(db);
if (FAILED(hr))
{
AfxMessageBox("session non Ouverte");
}
else
{
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
propset.AddProperty(DBPROP_IRowsetScroll, true);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );
bool bsavevalidation = true;
CWnd::UpdateData(bsavevalidation);
CCommand<caccessor<cdbotabcmdeaccessor> >cmde ;
CCommand<caccessor<cdborequisitionaccessor> >req ;
CCommand<caccessor<cdbodemprixaccessor> >dem ;
CCommand<caccessor<cdbodetcmde2accessor> >det ;
CCommand<caccessor<cdbodetlivaccessor> >liv ;
CString str1,str2,str3,str4,str5,str6,str7,str8,str9,str0 = "";
int i = 0;
strCommand = "select * from detcmde where numreq = '%s'";
strSql.Format(strCommand,m_numcmde);
hr = det.Open(session, strSql,NULL);
if (det.MoveFirst() != S_OK)
{
|
|
|
|
|
i got error as
error C2065: databas: undeclared identifier in
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, databas);
may i know why thise error occur?
JAYARAJ
|
|
|
|
|
It's true that you have this error because databas is a CString variable that contain the path of the database for example
CString databas = "SEM1" .
If you point mouse on the sql server Icon at bottom of the screen, you will see like this :Running- \\SEM1 MSSQLSERVER
SEM1 is the name of my database path.
In my second pc i have this Running- \\sem2\sem1 and here the path name is
"SEM2\\SEM1":
you can declare CString databas = CString "SEM2\\SEM1";
You will be happy
|
|
|
|
|
it is true;
I have declare this before :
CString databas = CString("SEM1"); It's the name of the databas path. You will the name of databas when you point the mouse on the icon of sql server on the bottom of the screen I see Running- \\SEM1 MSSQLSERVER
In the second pc i have Running- \\SEM2\SEM1 and in this condition the name of the path is "SEM2\\SEM1"
You will be happy
|
|
|
|
|
hello mikobi,
i like to display the table in my text area on clicking ok button.
my database server is in ist17
my database name is IstEncoder
my table is user_details
is my path is correct ?
what modificaton i should do in your code.
thanks in advance
=============================================================================void CDatabaseDlg::OnOK()
{
// TODO: Add extra validation here
bool bsavevalidation = true;
CWnd::UpdateData(bsavevalidation);
HRESULT hr;
CDataSource db;
CDBPropSet dbinit(DBPROPSET_DBINIT);
CString databas = "ist17";
CString strItem;
int k = 0;
CSession session;
CString strCommand,strSql;
dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR("yhwha"));
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("sa"));
dbinit.AddProperty(DBPROP_INIT_CATALOG, OLESTR("STOCK"));
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, databas);
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1036);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
hr = db.Open(_T("SQLOLEDB.1"), &dbinit);
if (FAILED(hr))
{
AfxMessageBox("impossible d'ouvrir la baseo");
}
else
{
hr = session.Open(db);
if (FAILED(hr))
{
AfxMessageBox("session non Ouverte");
}
else
{
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
propset.AddProperty(DBPROP_IRowsetScroll, true);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );
bool bsavevalidation = true;
CWnd::UpdateData(bsavevalidation);
CCommand >cmde ;
CCommand >req ;
CCommand >dem ;
CCommand >det ;
CCommand >liv ;
CString str1,str2,str3,str4,str5,str6,str7,str8,str9,str0 = "";
int i = 0;
strCommand = "select * from detcmde where numreq = '%s'";
strSql.Format(strCommand,m_numcmde);
}
CDialog::OnOK();
}
}
=============================================================================
My Error -------------------------------------------------------------------------------------------------------------------------------------------------
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2143: syntax error : missing ';' before '>'
error C2065: 'm_numcmde' : undeclared identifier
JAYARAJ
|
|
|
|
|
hi friends,
can anyone help me or guide me to create installable packages for the projects which i do in Visual c++ or visual basic.
i need to know what are the files to be packed with the execultable file and how to pack them.
Vasanth.
|
|
|
|