|
?? And the max characters that can be written in a single line?
|
|
|
|
|
ok, maybe I'm stupid, but it seems to me that after I called one constructor and the program returns it automatically calls another overloaded constructor.... why can this happen? I will check the program again tomorrow and try to describe the problem a bit closer and maybe provide some code, but just in case anyone has an idea I post this tonight.... drives me crazy right now... thanks!
Johanna
|
|
|
|
|
|
I am on a project that reads in assembler language from a file and then prints if out. here is an example.
input:
ADD 4,2,1
TEST
JMP 3
BR 14
ADD 3,7,9
the output should look like this:
Op code: ADD
Params: 4
Params: 2
Params: 1
Opcode: TEST
No Params.
Opcode: JMP
Params: 3
ect......
Here is what my code looks like:
int main()
{
string theLine;
string op;
string p;
ifstream infile;
infile.open("assembler.txt");
int line=0;
while(getline(infile,theLine))
{
cout<
|
|
|
|
|
You will have to parse the string that has the commas. Consider the line of code in your example:
cout << "Paramers:" << p << endl;
As it is now, p will point to the string "4,2,1" for example. You should test p at this point for commas, perhaps in a loop, parse and tokenize each number between commas, and print the result (each parameter).
-- modified at 16:27 Wednesday 14th September, 2005
|
|
|
|
|
Hello again,
I need to 'quickly' learn how to override some methods of the toolbar class. I'm pretty close to totally ingnorant of how I go about this so all help would be gratefully received. I know how to inherit from a base class but I don't know how to override methods and how to use my new class with the overridden methods.
I specifically looking at how to override the Enabled property so that instead of getting rid of the image it just shows a new image and how to override the button click method so that the button is no longer 'clickable' when enabled equals false.
If anyone could point me to some source code of how the base class goes about things I could probably work it out for myself - eventually .
|
|
|
|
|
I'm looking for someone who can create a print driver for Windows that converts documents to PDF and is free of all licensing. After converting to PDF, I would like the file to be POSTed to a web server.
PM me if interested, and I will send you a document that includes all specs and required functionality.
Thanks
|
|
|
|
|
Are you offering to pay someone, or are you hoping for a freebie ? I'd be looking in sourceforge as a first step, and downloading the PDF file format as a second ( it's pretty straightforward )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am offering to pay someone. Send me an email if you think you can handle something like this.
|
|
|
|
|
You would be silly to pay someone to do this, when there are commerical products you can buy that do it. Buying a library is always cheaper than paying someone to write a new one.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi, all. I got 4 warnings when build the application like this
"warning C4520: 'CRptLog' : multiple default constructors specified", when I tried to debug the code, got some assertion failed, because for somereason, they only want certain value for some calltype.....then I found the application has memory leak:
Warning: skipping non-radio button in group.
The thread 0x874 has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{1439} normal block at 0x0146D6B8, 2804 bytes long.
Data: < v w > 0A 00 00 00 08 F9 76 00 E0 77 17 00 00 00 00 00
{1438} normal block at 0x01450FA8, 18 bytes long.
Data: <data\download.db> 44 61 74 61 5C 44 6F 77 6E 6C 6F 61 64 2E 64 62
could anyone tell me is it because of the warning C4520 or the assertion failed causing memory leak?
the release works just fine.....appreciate any info.
|
|
|
|
|
valerie99 wrote:
warning C4520: 'CRptLog' : multiple default constructors specified",
Probably you have a default constructor ( CRptLog() ) and one that takes arguments and has default values ( i.e. CRptLog(int itemCount = 0) ). Now, if you call a constructor and don't specify an argument, which one will be called ? I don't know either.
valerie99 wrote:
got some assertion failed,
You should know more than that - you should go into debug mode from here to see where it happened, and find out what it was.
valerie99 wrote:
Warning: skipping non-radio button in group.
This means you have a dialog box where the radio buttons were not all put on at once, but it's still trying to group them together. No big deal.
valerie99 wrote:
could anyone tell me is it because of the warning C4520 or the assertion failed causing memory leak?
Neither, probably. The memory leak means you leaked memory, probably strings ? Do you use char * in your code ( you shouldn't, but still.... ). You should chase down the assertion, it's there to help you, and it can't if you don't pursue it. It may have something to do with your memory leak, but there's no more than a 50/50 chance of that.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all,
Just a quick one. How do I grey out toolBarButtons? When I use the Enabled property my button completely disappears. I've read somewhere that this is a bug in .net - can't remember where or even if this event ever actually occurred . Does anyone have a work around for this or could you at least point me in the right direction.
Thanks
Rich
|
|
|
|
|
I previously had a single funcion which did some operation in a sequential manner. Since the code became very huge, I decided to split the function into smaller pieces, say around totally 5 functions. Something like this,
OLD CODE
void a()
{
1000 odd lines
}
NEW CODE
void a()
{
b();
c();
}
void b()
{
d(); //called multiple times
}
void d()
{
e(); //called multiple times
}
e() is a normal function.
Is there any way by which I can calculate the delta in performance theoretically?.
kramkrish
|
|
|
|
|
I doubt it. The only way to know is to actually test it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What is linkage and what is use of internal linkage and external linkage?
rajesh
|
|
|
|
|
The notion of linkage is kind of complicated because the word describes code properties that can be understood within several different contexts.
The most obvious is referring to the compiling process when the LINKER is invoked to supply code linking the object files in your project to another existing external binary Library (typically a DLL) of funtions and resources.
Another distinct context for the term 'linkage' involves the using terms like 'extern' preceeding function prototypes being imported via P/Invoke, or Interop, (unmanaged code being inserted into a managed environment). This merely prevents the Visual Studio compiler from managling the name of the function. This is referred to as 'specifying linkage'.
I frankly hate the language that Microsoft engineers use to describe their technologies. It can be, and often is, confusing as hell.
I suggest you be more specific about the context in which the term is being used. In this case, I have described only two of possibly a dozen or more conventional usages.
But, generally speaking, internal linkage is similar to execution scope, and external linkage refers to separate compiled binary entities and dependencies in other programming languages or compiled by other vendor compilers.
You might find this article helpful:
Mixed Language Programming and External Linkage[^]
|
|
|
|
|
hi,
Can I take or compute tahe address of register variable?
can I make register variable as global or static?
Please let me know reason.
rajesh
|
|
|
|
|
Do you mean a location in the registry ? No. If not, what do you mean ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No, you can't take the address of a register variable - after all, what would its address be if it's in register?(!!) For the same reasons such vars cannot be static nor global.
|
|
|
|
|
Sorry, I should correct the last post, in ANSI C you can't take the address of an register var, in C++ you can. If you take the address of a register var, the compiler will place it in memory anyway.
Remember it's up to the compiler to decide which vars are placed in registers, so the register storage modifier is only a hint.
You cannot make such vars global or static.
|
|
|
|
|
I was wondering if somebody could tell me how self registering objects work when we use a anonymous namespace and static keywords. Is the registration done during compile time or run-time??
So, if i declare
//Create an Anonymous for the factory to self register frame classes, also such that the scope is limited to this file preventing the compiler from getting confused with methods of other frame types
namespace
{
Frame* createIFrame()
{
return new IFrame;
}
int FrameType = 1;
bool registered = FrameFactory::Instance()->registerFrameFn(1,createIFrame);
}
this code is inserted into the .cpp file of every class that is added new, how does the object registration occur without ever being called explicitly??
|
|
|
|
|
A method in an anonymous namespace is visible only to the cpp file in which it is written. It cannot be called from anywhere else.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The code sample is taken from Modern C++ Design by Andrei Alexandrescu. It works fine, registering the classes during compile time, why it works I do not understand. As you an anonymous namespace inside a cpp files that has the class definition,cannot be called externally.
But this method is called by ClassName::register and works fine.
|
|
|
|
|
I'm not sure I understand the scope of the code in question, but I suspect that Koenig lookup is the reason, if you're saying what I think you're saying.
Christian Graus - Microsoft MVP - C++
|
|
|
|