|
I have a Class called CDriver which is as follows:
class CDriver {
public:
// Constructor
CDriver();
CDriver(CDriver &driver); // Copy constructor
CDriver operator =(const CDriver d);// Assign one to another
~CDriver();
// Varables
CString csFirstName;
CString csMI;
CString csLastName;
CString csBirthDate;
CString csASSN;
CString csStreetAddr;
CString csCity;
CString csState;
CString csZip;
CString csHomePhoneNum;
CString csHireDate;
CString csTruckAssigned;
};
Now I made a vector: "vector<<cdriver>> vecDriver"; Also a CString vector: "vector<<cstring>> myCStringvec"; and an iterator "vector<<cstring>>::iterator myIT";
None of these work properly! I can get the "myCStringvec.push_back(temCString)"; to accept one and only one CString. I NULLed temCString before reloading it with data then again used: "myCStringvec.push_back(temCString)"; to no avail. WHY?
vecDriver doesn't work at all nor does myIT. Please ignore the "<< and >>" it would not show what I wanted to show without using two each!
C++ is my favorite programming language
|
|
|
|
|
The "Do not treat <'s as HTML tags" checkbox helps considerably when posting code.
Your assignment operator should probably take a reference (const CDriver& d )
What do you mean when you say that it doesn't work? What does it do/not do?
Larry Mills wrote:
I NULLed temCString before reloading it with data
If you did something like this:
temCString.Empty();
temCString = _T("Some New Data");
then that should be fine. If you did something more interesting, then there might be potential for error - please elaborate.
|
|
|
|
|
I did this: temCString = ""; Then I would reload this (worker CString) with the CDriver data that I extracted from the instance of CDriver that was loaded --> ADDING THE FILE DELIMITERS in this "temCString". The idea of the vector was it was supposed to hold the FILE DELIMITED CSTRINGS that comprised the CDriver data. Then I was going to send the vector CStrings to my DataBase file. But the vector will only load the FIRST sending of the temCString; after I temCString = ""; I reload that CString with the next FILE DELIMITED CSTRINGS from CDriver and attempt to send it to the vector. In debug mode the CString is correctly loaded and as I enter the vector using push_back() method it goes through the motions of receiving the data CString but when I check it the second attempt to load it fails --> it's not in the vector!
Any ideas?
Larry A Mills Sr
(Thanks about the tip regarding Do not treat <'s as HTML tags" checkbox.)
C++ is my favorite programming language
|
|
|
|
|
Looks to me like you're passing in the same string over and over, assuming that's what you mean by 'I NULLed temCString before reloading it with data'.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What I mean is that I clear out (NULL) the string ALWAYS, before I send the next data. (I load this class varable with all the data from CDriver WITH THE FILE DELIMITERS in this string. Then I would extract each string and send it to a file. I never got that far because I noticed that the CString was not being ADDED TO THE VECTOR after the first one was in the vector. I used the push_back() method with both CStrings.
Any ideas?
Larry A Mills Sr
VC++ 6.0 version
C++ is my favorite programming language
|
|
|
|
|
Hello
I want to use namespace in a com atl project in VC6. I don't know how i have to do this. I want to use this dll in C# and it will be nice to have namespace.
Tahnks,
Mihai
|
|
|
|
|
Anyone know if boost provides a way of escaping\unescaping regular expression metacharacters?
In Italy for thirty years under the Borgias they had warfare, terror, murder, bloodshed - but they produced Michelangelo, Leonardo da Vinci and the Renaissance. In Switzerland they had brotherly love, five hundred years of democracy and what did that produce - the cuckoo clock!
-- Harry Lime
|
|
|
|
|
Hi Friends,
I am looking for some very good book explaining SNMPv2 and MIB-II development in C++ (Object oriented approach). Please refer me any such book which i can buy form internet.
YOur help will be highly appreciated.
Best regards
Mukhan
|
|
|
|
|
I would like to do project "Thumb Rcognition and Authentication" using VC++ .
if any one has some idea plz send some suggestion.
Regarding the interface of the Scanner and the database.
And device drivers also
hello every body
|
|
|
|
|
??? talking about fingerprint recognition ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi all,
i have 2 annoying vc7 problems:
1. i use pragma warning disable for the 4311 and 4312 (sign mismatch)
doesn't seem to work...
2. i have in my solution 2 active x projects, everytime the solution compile them even if they were compiled a second ago...it for some reason thinks that the files are not up to date
question:
is there a way to disable the output "project xxx is up-to-date" and just tell the compiler to compile only the project that has been changed???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
#pragma warning must be outside the body of a function...
do you verify this ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
even better, it is declared in the stdafx.h above all the includes...
what about my other problem and question?
any1?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi
i want to know can we read dbf file with odbc if yes which driver should be used to mak the dsn.
ddd
|
|
|
|
|
Yes, DBF files can be read using ODBC. Look in your machine's list of installed drivers to see which one(s) can handle DBF files. Last time I checked, that was a dBase file format.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
thank u it works.
honesty is the best policy.
|
|
|
|
|
I am building a window in code (not via RC or dialog templates) and attaching EDIT controls to it. Upon completion, there may be 10 windows with 25 EDIT controls each.
Within each window (one displayed at a given time) I'd like to TAB between the EDIT controls. Unfortunately, the only examples I can find on the net (http://blogs.msdn.com/oldnewthing/archive/2003/10/21/55384.aspx)
want me to change my message loop to something like this:
if (IsDialogMessage(hwnd, &msg)) {
/* Already handled by dialog manager */
} else {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
My message loop is in a completely different C++ file/class. For this to work as described, I'd need to pass the application (or make it global) to every single EDIT control - or at least, find away to keep updating the "hwnd" used in the IsDialogMessage method above every time focus changed since that method works on a specific EDIT control at a time ...
Is that really necessary? I've built the EDIT controls with WS_TABSTOP style, and naturally, they are eating the TAB key. I can manually catch and GetNextDlgTabItem myself, but I wasn't sure if that was normal.
Is there a cleaner way I've overlooked?
Many thanks,
-Luther
|
|
|
|
|
Once you have built them, you could
SetWindowPos(CWnd* pWndInsertAfter,
int x, int y, int cx, int cy, UINT nFlags );
where
pWndInsertAfter identifies the CWnd object that will
precede this CWnd object in the Z-order.
|
|
|
|
|
I'm not sure how that helps me?
If I am in a TEXT EDIT box - and I press the "TAB" key, the MessageBell goes off and the "TAB" key is sent to the TEXT EDIT box.
If I manually catch the "TAB" key in a WM_CHAR message and manually call GetNextDlgTabItem and then SetFocus(nextItem) ... I get the behavior I want.
The ordering is fine. When I manually tab, I tab to the correct TEXT EDIT box. The problem is not the ordering or where I am going. The problem is catching the "TAB" key before it is sent to the EDIT TEXT box. That is what IsDialogMessage handles for me.
I'm just looking for some common idiom to handle this - since IsDialogMessage needs the HWND to check and IsDialogMessage must exist with the main message loop - 100,000 miles (so to speak) away from the rest of my code.
Does that help clarify anything? Thanks,
-Luther
|
|
|
|
|
Is it a modeless dialog? I'm having the same problem.
In modal dialogs, WS_TABSTOP does the job you want: send focus to the next control in the tab order when tab is hit. Modeless, nope...I get the same behavior. Help anybody?
|
|
|
|
|
Hi,
I am upgrading VC compiler on a windows machine from version 6.0 to 7.1
After upgrading when I tried to compile my application and got this error
\\Vc7\atlmfc\include\atlalloc.h(218) : error C2629: unexpected 'class ATL::CTempBuffer ('
I was able to compile code on 6.0 version
I am getting this error whenever "atlalloc.h" is included directly or indirectly in my cpp file.
Please tell me how to fix this
Regards... Ankur
|
|
|
|
|
some code that was compiling good under VC6 can fail under VC7 because not Standard C++ compliant anymore...
what is the failling code please ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I'm trying to rewrite an assembly program in C++. Instead of reinventing the wheel, I am cutting and pasting a lot of asm into __asm blocks. However, whenever I try to call int 0x21, I get an unhandled exception. Why is this and how do I get around it?
|
|
|
|
|
In this case you need to reinvent (most of) the wheel. The call int 0x21 (MS-DOS call) is probably allocating memory from the Upper Memory Area (UMA), which implies 16-bit code (old code). I am just surprised that that is the only problem you are asking about.
If you need to rewrite this old code, then you need to understand it:
1) You need to know what programing language the assembly code was ment to be accessed from (assuming it is not entirely in assembly).
2) Which version of the compiler was used (if possible).
3) Which processor it was written for (probably intel386).
4) What each of the assembly commands mean (+ what each function call does).
5) etc...
6) Break out or find the old books, on the calling language and the assembly language used.
The fact that you are trying this implies that you have a good idea of what you are attempting to do. If the assembly code (that calls int 0x21) represents a function call and you just copied it into and __asm block, in a C/C++ function, then post the funtion code.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
The assembly program was a stand alone application; it was not called from anywhere. I wanted to add some functionality to it, but it's been so long since I've programmed in asm that I've forgotten most of it. The compiler that was originally used to compile it was a86. It was written for the 286 intel processor. (16bit only) I'm familiar with most of the code and what it's supposed to do since I had left some comments here and there, but this is the first time I've ever tried to put asm and c++ in the same program.
Here is a block of code that's causing me problems:
;//;open file using handle (r/w)
lea dx, name
mov ax, 3D02h
int 0021h
jc end
xchg ax, bx
basically what it does is load the address of filename in memory into dx. name is a NULL terminated char array defined in the main() function. Then move 3D02 into ax. This will cause int21 to call function 3d which is the open filename command. The 02 byte in AL specifies to open the file in r/w mode. Then int21 is called to open the file. Afterwards the Carry flag is checked to see if the open was a success or failure. This should catch any errors with the open and prevent the program from crashing. (and yes, the label "end" is inside the same __asm block as the above code). Finally ax and bx are exchanged to put the file handle in bx. The next function called in asm code will require the handle be in bx, so might as well put it there now.
I debuged the above code and it crashes when it gets to the call to int21. I'm not sure what to do from here.
Also, I'm running Windows XP with a NTFS filesystem. When I run the asm code after it was compiled with a86, it runs fine.
thanks!
|
|
|
|