|
I've no idea. I've not used C++ in any of the .NET IDEs. Any C++ I do commercially is always in VC++ 6, and I haven't done any commercial C++ for over a year now.
Kevin
|
|
|
|
|
What is the principle motivation for having .h and .ccp files in visual C++?
Thanks, Moujan
|
|
|
|
|
Seperate the interface from the implementation.
John
|
|
|
|
|
|
Just an aside note: that's not a Visual C++ issue, but a C++ one in general.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
i find it hard to inherit the class CRecordset with the class wizard. Every time i do two set of files with the same name are created. one outside the folder of my project and one inside.
can you show me another way of adding, updating, and deleting values in a database without creating a new class that inherits the CRecord class.
Thanks...
----------------------------Life is simple, you just complicate things--------------------
|
|
|
|
|
It is not necessary to add with ClassWizard a new CRecordset-derived for each query as long as CRecordset has an Open and a Close method.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
can you show me a way on updating, deleting and adding records into a database?
------------------------Life is simple, you just complicate things------------------
|
|
|
|
|
|
I'm writing a programe about MFC by using viewport(win to view), but I don't know how to begin, so could you help me, could you give me some example
-- modified at 21:15 Friday 23rd June, 2006
|
|
|
|
|
Can you be more specific
whitesky
|
|
|
|
|
Hi, I have a very complex C++ object (with many class members and some of them are shared between different objects).
What is the best way to measure how much memory this object takes?
I tried the following:
before and after creating this object I call
GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))
and then use difference in pmc.WorkingSetSize between two calls.
However it doesn't work well since WorkingSetSize increased in balks. So sometimes I get a big memory increase and other times it is zero.
Is there any system function that allow to measure exactly how much memory was allocated between two calls?
Thanks in advance for help!
PS. I develop on Windows using Visual Studio
|
|
|
|
|
Try CRT debug support. Check out this CP article[^]
Best,
Jun
|
|
|
|
|
Hi,
I am using Visual C++ 6.0 MFC and want to store objects into an array. I tried using CArray but once I got the copy contructor so it would not give me compile errors I then got LINK errors. Since so many people on the internet sugested to others trying to use CArray to use std::vector instead I decided to use std::vector, the compiler gives me couple of warnings, but I still get LINK errors.
If I do this:
std::string strData = "One";
std::vector<std::string> strVector;
strVector.push_back(strData);
std::string strData = "Two";
strVector.push_back(strData);
It compiles, links, and executes just fine.
The object that I am trying to store is,
class CInstrument : public CObject
{
public:
CInstrument();
CInstrument(const CInstrument &Instrument);
CInstrument& operator = (const CInstrument);
virtual ~CInstrument();
int m_dGPIBAddress;
}
The .cpp file implementation is:
CInstrument Instrument;
std::vector<cinstrument> Instruments;
Instrument.m_dGPIBAddress = 9;
Instruments.push_back(Instrument); // If I comment this lin out I do not get link errors
Does anyone see whats wrong here? Also, as a side note, Visual Studio has a popup that comes up after the ObjectName'.' so you can select the objects members. The popup does not come up for the Instruments'.' vector. This shouldn't be this difficult as I have already spent 12 hours trying to build an array of objects of class CInstrument.
Thanks,
Buck
|
|
|
|
|
You need to use the pre, code, < and > Formatting buttons at the bottom of the editor area otherwise we can't see your code correctly.
You also need to tell us the specific compiler and linker errors you are getting.
Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com
|
|
|
|
|
Need to know if there is an API
1) to get the directory listing
2) To be able to search for a particular file extension
As for eg
Say i have a file i need to search for like AM01.txt in C:\temp1\temp2
I need an API to list the folders --> temp1 and then temp2
Then an API to filter *.txt files in that folder
Any ideas ?
Engineering is the effort !
|
|
|
|
|
have you looked at CFileFind class?
|
|
|
|
|
act_x wrote: 1) to get the directory listing
Use the FindFirstFile() /FindNextFile() pair.
act_x wrote: 2) To be able to search for a particular file extension
See above, just use *.txt in the pattern.
If you know the exact name of the file, and simply want to check for existence, use _access() or GetFileAttributes() instead.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for your responses
Engineering is the effort !
|
|
|
|
|
See
<br />
(1)<br />
TCHAR lpt[260];<br />
lpt[0]='\0';<br />
strcat(lpt,"c:\\");<br />
GetCurrentDirectory(sizeof(lpt),lpt);<br />
DlgDirList(lpt,IDC_LIST2,NULL,DDL_DIRECTORY|DDL_ARCHIVE);
-----------------------------<br />
(2)<br />
WIN32_FIND_DATA find;<br />
HANDLE handle=FindFirstFile("*.*",&find);<br />
while(FindNextFile(handle,&find)!=0)<br />
m_List2.AddString(find.cFileName);
FindClose(handle); <br /> maybe it is some helpful to you
whitesky
|
|
|
|
|
I'm having trouble grasping Binary file I/O.
I am trying to read back a binary file that includes the following example...
char type[9]="File Type"
short MajorVersion = 1
short MinorVersion = 0
Using most methods found, I can read "File Type" but it's got garbage appended to it, so I cannot compare with a known type.
Also, I'm having trouble going beyond that. Meaning, I cannot access the version shorts.
The examples I've come across doesn't go into any depth about multiple types, or how to retrieve multiple items from a single buffer read.
Do I need to flush the buffer, and reposition my pointer?
What's the best way about getting this information out of my file?
Can someone give me a quick example of how to retrieve this data, and what method is most efficient?
Jeff
|
|
|
|
|
Jumpin` Jeff wrote: Using most methods found, I can read "File Type" but it's got garbage appended to it...
Exactly how are you reading the file? If you are reading nine bytes from the file, it should work.
Try this:
struct
{
char type[9];
short MajorVersion;
short MinorVersion;
} myStruct;
FILE *pFile = fopen(..., "rb");
fread(&myStruct, sizeof(myStruct), 1, pFile);
fclose(pFile); Depending on what you do with type , you may need room for a \0 character.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you for such a quick responce David!
Using your example, I come up with similar to previous results....
The version shorts should have been Unsigned, My bad, but I used the following to display the extracted information....
cout << myStruct.type << "\n" << myStruct.MajorVersion<<"."<
|
|
|
|
|
Jumpin` Jeff wrote: File Type@ <- Actually a smiley symbol...
You will not be able to treat it as a nul-terminated string unless it actually ends with a \0 character.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Just a recommendation:
Instead of assuming your string is X number of characters long, write the string length first, followed by the characters in the string:
struct FileData<br />
{<br />
char* String;<br />
short MajorVersion;<br />
short MinorVersion;<br />
};<br />
<br />
FileData data;<br />
FILE pFile = fopen(..., "wb");<br />
long size = strlen(data.String);<br />
fwrite(&size, sizeof(size), 1, pFile);<br />
fwrite(data.String, size, 1, pFile);<br />
fwrite(&data.MajorVersion, sizeof(short), 1, pFile);<br />
fwrite(&data.MinorVersion, sizeof(short), 1, pFile);<br />
<br />
FileData data1;<br />
FILE pReadFile = fopen(..., "rb");<br />
long readSize = 0;<br />
fread(&readSize, sizeof(readSize), 1, pReadFile);<br />
assert(readSize > 0);<br />
data1.String = new char[readSize + 1];<br />
memset(data1.String, 0, readSize + 1);<br />
fread(&data1.String, readSize, 1, pReadFile);<br />
fread(&data1.MajorVersion, sizeof(short), 1, pReadFile);<br />
fread(&data1.MinorVersion, sizeof(short), 1, pReadFile);<br />
If you write the structure as a class, you can put the serialization code as a class member and have your code just call MyClass.Read/Write to make it very simple.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
-- modified at 16:03 Friday 23rd June, 2006
|
|
|
|
|