|
have you tried DiskId ?
search in the Internet get the source code,don't use DiskId32.dll,
it cann't run at some of os.I can give you my own code if you want it.
|
|
|
|
|
I tried diskid, it works, but I wanted to find something else. Thanks for all.
|
|
|
|
|
Hello everyone!
Alright... I have this file:
<br />
|............||<br />
...............<br />
...............<br />
...............<br />
...R...........<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
|.............|<br />
I need to read, for example, character at (4,5) (letter R). How do I do that, in standard C++? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
-- modified at 12:32 Sunday 5th February, 2006
|
|
|
|
|
read the lines one at a time until you get to the required line, then get the required character
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
int row = 0;
int col = 0;
do
{
cout << "Enter line number ";
cin >> row;
cout << "Enter column number ";
cin >> col;
if (row < 1 || col < 1)
return 0;
ifstream ifs(argv[1]);
string str;
int x = 1;
for (x = 1; x <= row && !ifs.eof(); ++x)
ifs >> str;
if (ifs.eof())
cout << "Invalid line" << endl;
else if (col > str.length())
cout << "Invalid column" << endl;
else
cout << str.c_str()[col - 1] << endl;
ifs.close();
} while (1);
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: ifs >> str;
Hmm... I don't get it... Is that suppossed to get a line? Is there a C-style equivalent? I don't want to use C++ style, it makes my EXE like 200 KB bigger! Or is it suppossed to do something else? Much thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Kixdemp wrote: I don't want to use C++ style
In your original post you asked for standard C++, so that is what I gave you.
Kixdemp wrote: Is that suppossed to get a line?
Yes, The C equivalent is fgets() .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: Kixdemp wrote:
I don't want to use C++ style
In your original post you asked for standard C++, so that is what I gave you.
Whoops, sorry, I confused terms...
But I'll try that if what I said in my other post doesn't work... Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
string curLine;<br />
f[x] >> curLine;
That gives out errors, because f[x] is a pointer, look:
ifstream * f[3];<br />
f[0] = new ifstream(string(map + ".ml1").c_str());<br />
f[1] = new ifstream(string(map + ".ml2").c_str());<br />
f[2] = new ifstream(string(map + ".ml3").c_str());
I already tried this:
string curLine;<br />
(ifstream&)f[x] >> curLine;
But that just crashes my app... Is there a correct way to do it? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
I have written a few applications in VC++ 2003 that access database information via ODBC. The typical application makes various SQL requests and displays the results in a Single Document CListView, using the report style.
The programs seem to execute fine as long as they have complete focus with uninterrupted processing time. If I try to minimize the window or check my Outlook email or use some other application while the database application processes some lengthy data retrievals, the database application hangs up.
Any ideas or suggestions to make the program work more efficiently?
Thanks for any comments!
|
|
|
|
|
|
Thanks! I had a feeling I might be headed in the direction of using threads.
|
|
|
|
|
Hi,
I need to write an application that:
1. opens a database (I connect through ODBC)
2. retrieves data from a table, using an SQL query
3. enters the retrieved data into a table in a different database
So far, I wrote the following code for steps 1 and 2:
CDatabase srcDb;
if (srcDb.Open(NULL))
{
m_sDbName = srcDb.GetConnect(); //m_sDbName is a variable of type CString
UpdateData(FALSE);
}
CRecordset rs(&srcDb);
CString strSQL;
strSQL = "SELECT * FROM table1";
rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly);
rs.Close();
Everything works OK, (the database is connected), but when it gets to the row:
rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly);
the application crashes, and I don't understand why...
Is this the right syntax for connecting to a database and retrieving data from a table? Can someone maybe attach some source code, so I could compare...
Another question - after the row: rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly); is executed, how do I read the data that was retrieved by the SQL query? is it in the recordset object?
Note: I am using Visual C++ 2003.
|
|
|
|
|
Seems like you are doing something similar, but this code works for me throughout my appliations that connect to databases via ODBC. I'm also using VC++ .Net 2003.
rs.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL,CRecordset::none);
|
|
|
|
|
ok - but how do I see/read the data that I retrieved with the query?
And could you maybe write the rest of your sourcecode - how did you connect to the database, how do you read the data from the query?
Thanks
|
|
|
|
|
Here is a simple example. I left out A LOT of defensive coding to keep it short. Usually I am connecting to a single database within SQL server or Oracle, so I like to do this once and keep the connection open for the duration the application is active. Thus, I use a pointer to the database object and allocate memory for this with the new command (followed by a delete command later). I am usually in and out of recordsets so I tend to just create these objects within the functions that use them.
// Create and Open the Database via ODBC
CString strDSN = "DSN=The_DomainServiceName_Here; UID=User_ID_Here; PWD=Password_Here";
CDatabase* m_pDB;
m_pDB = new CDatabase;
m_pDB->OpenEx(strDSN,CDatabase::openReadOnly);
// Create and Open a Recordset connected to the database above
CString str, strMessage;
CRecordset rs(m_pDB);
str = "SELECT SOME_FIELDS FROM SOME_TABLES WHERE BLAH BLAH... ";
rs.Open(AFX_DB_USE_DEFAULT_TYPE,str,CRecordset::none);
while (!rs.IsEOF())
{
rs.GetFieldValue("FIELD_NAME1",str);
strMessage += str;
rs.GetFieldValue("FIELD_NAME2",str);
strMessage += " ";
strMessage += str;
rs.MoveNext();
}
AfxMessageBox(strMessage);
rs.Close();
m_pDB->Close();
delete m_pDB;
m_pDB = NULL;
Hope this helps.
|
|
|
|
|
Ok - thanks, it helped, but just a few questions:
1. I need to do the connection to the database from one function (when a user presses a certain button) and open the recordset in another function (when the user presses another button). How do I do this? make the CDatabase object global (a member variable)? Also, I want to get the strDSN string information from the user by opening a dialog box and letting him choose a data source. Again, how do I do this?
2. can I read the data from the records somehow else - not to a string?
3. does my class (in which I am doing all of this db handling) have to inherit from CRecordset?
3. what did you mean by: "I left out A LOT of defensive coding" ?
|
|
|
|
|
SWDevil wrote: ...the application crashes, and I don't understand why...
Have you stepped into the Open() call to find out why?
SWDevil wrote: Another question - after the row: rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly); is executed, how do I read the data that was retrieved by the SQL query? is it in the recordset object?
Derive a class from CRecordset . Its member variables will hold the vales. Otherwise, using CRecordset directly will require you to use GetFieldValue() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
yeah - I tried stepping through the code..
But now I sometimes get an error saying that columns were not bound. do you know what that means?
About the recordset - what member variables hold the values? I looked at the MSDN help and could not see any variables that actually hold any data...
|
|
|
|
|
SWDevil wrote: About the recordset - what member variables hold the values? I looked at the MSDN help and could not see any variables that actually hold any data...
ClassWizard creates them.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hello!
Does Visual Studio 2005 Standard[^] support MFC and ATL?
If so, can the MFC libraries be statically linked to the application in the Standard edition?
Can I still develop native MFC applications, that don't use any of the .NET stuff?
Thanks in advance and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Yes to MFC support.
Yes to ATL support.
Yes to MFC static linkage.
Yes to MFC without .NET.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
Deal All,
In my project I am processing web pages. I want to know the different components of a web page.
I know that it is possible to extract html elements (tables, divs, images ...) using the html DOM tree. But I am not sure if its possible to recognise flash animation and pop-ups (dynamic elements) within a certain web page.
Does any one know if this is feasible or not? if it is so, can you please advise me on this task.
Thank you
llp00na
|
|
|
|
|
Can you help me abuot the text rotation like the behaviour in InDesign (text and cursor rotated).
Can yuo send me an example?
If the text is rotate also the cursor will be rotated.
Thanks.
|
|
|
|
|
Where do you want rotate text (screen, control and etc.)?
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
following is the CreateFontIndirect example in msdn.
HFONT FAR PASCAL MyCreateFont( void )
{
CHOOSEFONT cf;
LOGFONT lf;
HFONT hfont;
// Initialize members of the CHOOSEFONT structure.
cf.lStructSize = sizeof(CHOOSEFONT);
cf.hwndOwner = (HWND)NULL;
cf.hDC = (HDC)NULL;
cf.lpLogFont = &lf;
cf.iPointSize = 0;
cf.Flags = CF_SCREENFONTS;
cf.rgbColors = RGB(0,0,0);
cf.lCustData = 0L;
cf.lpfnHook = (LPCFHOOKPROC)NULL;
cf.lpTemplateName = (LPSTR)NULL;
cf.hInstance = (HINSTANCE) NULL;
cf.lpszStyle = (LPSTR)NULL;
cf.nFontType = SCREEN_FONTTYPE;
cf.nSizeMin = 0;
cf.nSizeMax = 0;
cf.lfOrientation = 180; // specify angle that you want.
// Display the CHOOSEFONT common-dialog box.
ChooseFont(&cf);
// Create a logical font based on the user's
// selection and return a handle identifying
// that font.
hfont = CreateFontIndirect(cf.lpLogFont);
return (hfont);
}
Enjoy
Anderson Sheen (exteide@gmail.com)
The Extension IDE: http://www.exteide.com
|
|
|
|