|
did you think about converting tmpbuf into a number before doing the operation ( and back to a string after ) ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Shaitan00 wrote:
I assuming either some casting or conversions are required
Thats right. You cannot perform any arithmetic ops on a char array and and integer like that in a meaningful way.
You will first need to convert your array, tmpbuf, to its numeric value. Do the arithmetic using the two numbers, then reconvert back to its string representation.
Shaitan00 wrote:
tmpbuf = tmpbuf - arith;
This will not work as you cannot copy array values like this. You can use the memcpy function for this, but only for array transfer.
Use the atoi() function to convert your string to a number. then you can use the itoa to reconvert.
I Dream of Absolute Zero
|
|
|
|
|
Shaitan00 wrote:
tmpbuf = tmpbuf - arith;
DON'T DO THAT!
You are attempting to change the address of tmpbuff from 0x0012c434 to 0x0012c432. You cann't do that since tmpbuf is an array (not an l-value) and not just a pointer. If it was a memory pointer it would still be wrong (crash city)!
char buf2[5];
strcpy(tmpbuf,_itoa(atoi(tmpbuf)-arith),buf2,10));
This would do it, but there is no error checking. What would happen if the number contained more than 4 digits? I recommend you use a larger buffer, since you are working with intergers, the buffer should be a minimum of 12 (10 digits + 1 for '\0' + 1 for '-') characters. That assumes that the value will be no more than a 32 bit number, in the near future it will be a 64 bit number and the code will break.
Sorry about that, but when I see code like that my heart skips a beat.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Can I force the scrolling in CRichEditView to line scrolling? Do you know
which parameters or events should I change or override? Thanks
Maggie
|
|
|
|
|
Does anyone know if there is a way how to export emails from the Inbox/Outbox into .msg files programmatically?
I tried using the Outlook Object Model, but it asks the user for permission to access the mailboxes and ideally I would like to avoid that (no, i'm *not* writing a virus... - i just would like to do away with user interaction while the program is running ).
I also tried using MAPI, and i managed to read emails individually into the IMessage interface, but I can't see how I can stream its properties to a file without iterating on the properties one by one (and potentially risking modifying one property indadvertedly and ruining the entire message).
My recent attempt has been with CDO but again, the MessagePtr interface in cdo.dll doesn't seem to support any streaming.
Anyone has a better idea?
|
|
|
|
|
I have installed on my PC a PCI card which implements RS422 via an API.
Now this API has calls to install and uninstall an interrupt handler; and use this handler to drive conditions such as data sent.
Now I have used the interrupt handler via a Win32 console application, but it seems not to work when I try and use it in a MFC Dialog application - Dont get any interrupts.
I dont know if the handle should be a class member of the dialog, at present its not as thats the only way I could get it to compile.
Two questions:-
1. How does this scheme work (just a simple overview please)
2. I was hoping to use the interrupt to handle time events that need to take place every 40 msec. Can interrupt handlers be installed (via this API) for a MFC application.
Many thanks,
|
|
|
|
|
Pehaps you should ask the providers of the API these questions.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I have done so, but the responce can take quite a while.
I think the problem is around the MFC framework and they may not wish to comment or offer support on that; i.e. works for a win32 and a straight C program, hence the question in this forum.
|
|
|
|
|
OK, perhaps you ought to mension who wrote the API. Perhaps others here have used it and know what quirks it has.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi,
I am upgrading the underling database in my application from Access 97 to Access 2000. I took the approach that I need to update STDAFX.H. Within this resource file is an #include of afxdao.h. I can’t find it on anywhere on my system. (everything compiles ok so it does not seem to be a problem not being there.
Is this the correct approach?
If a down load a new version where does it go in my project
I am using CV++ Can someone assist me in the right direction?
Thanks
TomH
|
|
|
|
|
Ouenstreet wrote:
I am upgrading the underling database in my application from Access 97 to Access 2000. I took the approach that I need to update STDAFX.H.
A change to stdafx.h should not be necessary simply because you went from Access 97 to Access 2000.
Ouenstreet wrote:
Within this resource file is an #include of afxdao.h. I can’t find it on anywhere on my system. (everything compiles ok so it does not seem to be a problem not being there.
Is this the correct approach?
If you've commented out the #include <afxdao.h> statement and your application still compiles ok, it obviously means the file is not needed.
Ouenstreet wrote:
I can’t find it on anywhere on my system.
I found it on my machine in the ...\VC98\MFC\Include folder.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks so much.
I can't believe I missed it. I have upgraded my app to Access 2000 and so far it works. Still more testing to do.
I had to make some minor changes to Daocore.cpp file in the MFC SRC directory and some minor change in my app.
I get lots of answers on this board. Thanks much for all you do.
TomH
TomH
|
|
|
|
|
Ouenstreet wrote:
I had to make some minor changes to Daocore.cpp file...
Generally not considered a good idea. This requires that you rebuild and redistribute the MFC DLLs.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
http://www.codeproject.com/Purgatory/blackozemia.asp
This artivle is word for word out of Deitel's book, C++ How to program book.
This is illegal unless you asked permission First osbano
|
|
|
|
|
My suggestion would be to notify the author of the article, the CP webmaster, and the author of the book. Posting such a message to this forum really serves no purpose.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
At first I thought it meant "A swarm of deadly locusts will descend upon your crops..." or "A horde of angry bullfrogs will infest your rice paddies..." but then I realized he must have meant plagiarizms...
|
|
|
|
|
Blake Miller wrote:
plagiarizms
plagiarisms.
If you are going to criticize someone else's spelling, you had better make sure your own spelling is correct.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Anyone pls can help me on this: i want to read the signal I apply to the line in on the soundcard. It is not necessarily an audible signal ... I simply want to use the soundcard as an AD converter. Thx in advance.
|
|
|
|
|
I am working on a VS.net project. The project has a backup, debug, release, hlp, and res folder. I only want to save the required project files to a version manager program and not save any unnecessary files like .obj files, etc. Which folder(s) contains the necessary files for a project that should be saved??
Jerry
|
|
|
|
|
Your best to back up your main project directory, minus the debug and release folders. The company should keep a copy of the development enviroment and related files, incase the code needs to be recompiled/debuged in the future. That is if the company changes the development eviroment in future years, they need to be able to reproduce the origanal eviroment years down the road (or until the program is no longer supported).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
look it up in the header file..
If you don't know which is the header file that defines it, do a search for a *.h file with the constant you wonna know the value of. Make the search case sensitive to avoid too many invalid files... But I guess with a const like PURGE_TXABORT even case-insensitive search will result in correct file...
Greets,
Davy
|
|
|
|
|
Place the cursor anywhere on the PURGE_TXABORT value and hit the F12 key. You may be asked if you want to build the browser database.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
check out afxres.h
regards
pradeep
Between the great things we cannot do and the small things we will not do, the danger is that we shall do nothing
|
|
|
|
|
Why? What does that have to do with my reply to wk_vigorous? Knowing where something is located is one thing, but knowing how to find it is another.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I've read a few times that "..doing it THIS operation is no faster than doing it THAT way; just look at the assembly after it's compiled" - or something like that. I've used the Win32 disassembler to look at code, and even seen the assembly for an .exe in VS. But if I write a function, how can I view the assembly for that specific function, so that I could see which takes more operations?
int i = 2, x = 2;
int j = x + y;
sprintf("%d",j);
4.7388937 ???
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|