_printf is not resolved until linked, therefore you have to make the complier aware of this.
extern _printf
I haven't had any success using standard "C" libraires so I use wsprintf which is part of kernel32.lib
_printf is not resolved until linked, therefore you have to make the complier aware of this.
extern _printf
I haven't had any success using standard "C" libraires so I use wsprintf which is part of kernel32.lib
It appears there are two ways you can do this. (1) I assume CodeWarrior is on a different computer, so after compiling/assembling your code create a flat binary file and this can be read through the serial port using TwinPeeks or (2) Emit machine language listing and enter it directly using TwinPeeks again.
TwinPeeks appears to be somewhat similar to debug in DOS.
I am an avid and would even venture to say an excellent assembly programmer. In the early 80's my assembly overlays to basic where an essential component to greater throughput. Example sorting 1,000 elements in basic would take 11 mins and with the overlay 30 sec with the kind of hardware available then. BIG difference. Can any compiler code as effectively as a good assembly programmer, never. Today though I even question why compilers even have the ability for inline assembly. Most operating systems and especially the two most popular ones don't allow you to address hardware directly and the amount of code you can crank out in an afternoon is monumental with a "C" compiler versus assembly.
So unless you plan for some reason becoming an extremely good assembly coder, I wouldn't even bother with it. I know if my experience didn't come from a time where it was needed I wouldn't bother for the few milliseconds you might eek of of an application over what most compilers can do.
I've read your private message and appealing to me on what you perceive to be a private area is not going to work. Although I empathize with your dilemma, but there are two problems. (1) Your depriving other members of what might be a solution or partial solution to their problem, which defeats the purpose of a public message board. (2) As this is your first thread, you may not appreciate that those of us that have been here for a while anticipate the weekend panic scenarios . I am more than willing to help, but you MUST produce some relevant code first.
but i can't compare 2 digits or more. only 1. Can you give me a sample output like in Aquarius and Pisces that i can be used as a referenced? Please..
1 am already..:(
I'm not sure what you mean by this, but when making comparisons if you have more than one value you do it successively, meaning check value A then if true value B and so on.
Loop example:
Pointer dw 3f, 22, 18, 19, 47, 5f, 18, -3, 0
mov esi, Pointer
Loop
lods
cmp ax, 0
jz Done
lods
cmp al, 5fH
jnz Done
jmp Loop
Done
You can see by this example 18, -3, 0 are never evaluated. This is how you would test data pairs or at least one way of doing it.
I never write code from scratch without you making some sort of legitimate attempt in the form of code. Remember too please to enclose your code in tags code & /code
After you've entered Month & Day, your program has no way of knowing which sign those entries are applicable too.
One way would be to calculate the number of days that have elapsed since Jan 1 and then compare that with a table that provides a pointer to appropriate text using a loop
Signs dw janA, 20, febA, 48, febB, 78
Notice how Signs are in data pairs (1) Pointer to the text (2) Maximum value before next sign.
You can use whatever menthod you like, but basically in a loop you will compare you calcuated day number with that of the maximum for that sign. As soon as the value is less than the one in the table you know the previously read is the correct sign
I see what you mean in respect to the first example and the only conclusion I can come too is although new processors are backward compatible, but there are problems when attempting to use the high order bits of a 16 bit value. If you have access to a 286, see if there is a difference.
The remainder problems, I can't really figure out what your driving at there, but using the bx or bl registers does give me the desired result of 774 in ax and 8 in dx
Let's see your code for doing indvidual lights and explain exactly what you mean by "running lights"
Start with
int main () {
int a = 2, c = 1, b, d;
while (c < 100) {
b = 2;
a++;
/* Implement your next loop here changing the logic a bit */
}
return 0;
}
This is how you get rid of loop1. Use the same principal now to get rid of loop2, but you will have to change the logic of your conditionals to make it work. I can't do much more than this without doing the whole thing, so let's see what you come up with
i want to do project on games please can u help me?
Post a new thread, and I assume you've read all the posts in this one so be a little more informative of what you have in mind. Make your subject line representative of your intentions and we'll take if from there.
int TxtSize = GetWindowTextLenth (hwndEditBox) + 1;
char *Entry = new char [TxtSize];
GetWindowText (hwndEditBox, Entry, TxtSize);
MessageBox (NULL, Entry, "", MB_OK | MB_ICONINFORMATION)
delete Entry [];
I'm pretty rusty at C++, so note useage of NEW & DELETE
Well it sound like you've got the logic already figured out, and dependant upon operating system I would recommend researching high precision timers in either *nix or windows.
Sure, would be glad to help if you need it.
When creating an "EDIT" window there are several flags associated all begining with ES_. The one you want to use is ES_AUTOHSCROLL in dwStyle.
Without seeing your code or header file it's impossible to know where the problem is, but my implementation would have each node with two pointers. One to students name and other to array of grades. That way each node is exactly 8 bytes, which reduces overhead for sorting and seach algo's.
Assuming your using CreateWindowEx, change the value of y (vertical position of window) before the next window is created.
It almost looks like you threw something out in the wind in the hopes that someone will fix it up for you. Clean up your code with indentation to begin with so it's a little more legible. Then run it to see if you get the results you expect. Right off hand without spending to much time it appears the only time leaps years will be evaluated is when the month is less than 1 or greater than 12.
Please enclose your next post in code tags.
if(yr>=1990 && month<=2020)
You see the problem here.
Post notes on all the things you want the program to do and what the user interface is going to look like.
#1: Maximum length of input
#2: Number of players
#3: Scroing method
#4: Ability to save games/scores (yes/no)
#5: Clue(s)
To give yourself control over keyboard, color and cursor positioning I would recommend curses library, but termio works alright too.
So basically think of the program as you conceptualize it virtually then start making notes as if you were actually playing it. Assuming you want to do the app I've mentioned earlier, I would start with the entry and then center it vertically and horizonally on the screen only using 60% of the screens width.
Examle: EARTH IS THIRD PLANET FROM SUN
Output:
----- -- ----- ------ ---- ---
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
So as player selects letters they will disappear from display below and if applicable replace '-''s. The scoring method I used was give each letter a wieght value of 1 to 10. 10 being most frequently used letter, usually vowels and 1 to least used like 'X'
If you next post doesn't have any meaningful code then there's not much point going on, because I'm not going to start writing the program for you.
Actually I don't have any idea yet for my project...I don't know what kind of game or any kind of project I'd like to make
I've already given you one idea, apart from that there's not much I can do until you decide on something
Actually, I won't give you any code. This is in part to the fact and like I said I don't have a linux box. You probably won't find anyone else to give you code on this site either. What I can do for you though, is start breaking it down and then you build the code for each part and I can verify for you whether it's going to work or not.
One that I've done and called it Phrase Guess was pretty simple. Allow player to enter a phrase or sentence, pretty well anything, including a clue. Then it's redisplayed with just underscores but in a way you can tell how many words there are and number of letters in each one. Assign weight values to each letter. For example 'E',s and vowels would have a value of 10 and the least common letter would have one.
I could go on for quite a while, but if you are interested in this one then start here first and I will help you as you go on or at leaset try. I don't have a linux box anymore so if your using ncurse your pretty well on your own as far as the interface goes.
Pentium class processor also have BT (Bit Test) that is non destructive unlike Salem's examples.
bt eax, 0
would test bit zero and return CY = 1 if set otherwise 0. Otherwise boolean operators like in the previous post are the best alternative or choice.
One of expecption handlings greatest claims to fame is ability to unroll the stack. Lets suppose you have subroutines "A", "B", "C". Your main code establishes a try block, where in it you call "A" and then "A" calls "B" and "B" calls "C". In "C" there is an error and you throw and expection and it will revert right back to the catch statement in your main module re-establishing the stack as if it had returned normally to that point
Somewhat similiar to the way ON ERROR GOSUB works in VB
So what I try to do is in all my subs and fuctions just throw exceptions and implement appropriate try blocks in the main body of program.
http://relisoft.com has some pretty good tutorials on this already incorportated into full functioning programs.
Exactly, keep related stuff in the function or subroutine.
Similar to goto statements, I've found multiple return paths are as equally problematic. If line 25 is executed then hFile is still open
The only thing I can think of is that another process or instance of this application already has the file open, and because you are not sharing the file this would not allow the handle to be created. Other than that, your code is correct.
#1: Determine the type of intrusions and possible frequencies.
#2: Research the type of equipment that is suitiable for intended purpose. Alarms, cameras, sirens etc.
#3: Is there existing software for devices best suited to your application. Older PC's are sometimes a viable option
#4: Imlement prototypes and do some peliminary testing on fixed senarios.
Similar to software development the analysis stage can at times take longer than development and implementation, but it is probably the most important
Set a soft break at CreateRawDataBUFR then a watchpoint at rdi, or set the same softbreak and a watchpoint to the location where rdi is stored and another at the contents that rdi points too. Then by single stepping see which changes at what point int the subroutine.
Hamrick's link is about as succenct as you can get. The why on the other hand probably will never be know. It could be deliberate, accidental or just a matter of convienence as code is being developed, modfied or upgraded. Concentrate more on the API's that provide you handles to files, memory, windows etc, and how they are used in other API's.
I hope you're not surprised that intel's compiler has better optimizations because they _make_ the processors, and not because you just don't like microsoft. ;)
That being said, Intel is quite liberal with their documentation so there is no reason M$ couldn't have an equal or better compiler.
Thank's. Better than M$, why am I not surprised. I like the idea too that I can use it with my existing IDE.
Using VC++ 6.0, setting this option doesn't seem to do anything significant. Specically, I can still run the app on a 486. I've drilled into assembly and can't find anywhere that Pentium opcodes are being used. My guess would be timing and as I don't have any references to that I can't really be sure.
I would appreciate a short snippet with and without the option being set and a listing with machine, assembly and source.
Thanks
SP is a special purpose register and it should never be used for anything other than what it was intended and you realize that anyway by your comment this is wrong. You've got the right idea using index registgers, but you're failing to use instructions that give these registers thier potential, like LODS & STOS.
loopi:
lodsb
sub al, [di]
stosb
loop loopi
In the first part of you app move the contents of arrayE to arrayX and then setup
mov si, arrayE
mov di, arrayX
mov cx, 5
rep movsb
Then you can execute the snippet before this one. Realize my example is over simplistic and I use NASM, but I sure you'll get the idea.
In assembly programming try to avoid moving data from memory to register, doing a calculation and then moving back again. There is unecessary overhead in both code and time.
So you see lollerskates the can of worms you've opened. Everyone in my opion in this thread has presented perfectly valid points probably based on past experiences. It all comes down to you (lollerskates), what do you feel comfortable with. You know all the subtle neuances of your client, but I would suggest because you came to this forum maybe there is something you just are not to sure about. Bottom line, I don't beleive there is a succenct solution to your question
Excellent points cscgal, and you can be rest assured everyone in a court room would have the same questions. What does this equate too, $$$$ flying out of your wallet while lawyers argue the point. I didn't mean to suggest that I copyright snippets, but as they are a part of the whole, I belive it can lead to a gray area at best. Therefore I devulge nothing, especially as it applies to the application as a whole. In Canada we can replace snippets with puesdo code or black out up to 30% from the source and still copyright. In any case it is common practice to copyright entrie applications. Yet, the battles between M$, Apple & Sun in the past demonstarte how tenuous these situations can become.
Copyright laws internationally seem to have an element of universality and that is why "The Verve" lost all revenue to thier song "Bittersweet Symphony" because the first part of the song belonged to something Mik Jagger & Keith Richards had copyrighted. Jagger got 50% and Richards got 50% all because 4.7% of the song consisted of what belonged to them.
As far as I'm concerned GPL in lollerskates case is one of the more viable options as you can see how effectively it worked for LINUX.
I got hundreds of snippets that I've developed over the years. Now if I gave someone else the source and they copyrighted it, then I wouldn't be able to use work that I've taken so much time and effort to developed in other programs. The only way I would relinquish source if I copyrighted it and had exclusive rights, OR another way you can do it is to GPL. Long story short, nobody gets my source.
I've only done one job where the customer provided me with all the details, data layout, flow charts etc. All I had to do was code appropriately, therefore the code was thiers'
I don't know, if iamthwee's link doesn't give you the answer then I guess there isn't one.
If you don't return a value to the operating system, then whatever happens to be in EAX at the time will probably be returned and this may cause undesirable results. That is why void main () is a definite NO NO!
I did some more expirements with the program today and found out something weird,it seems that it only has a problem with reading from files when it reads into a "floating point variable" (double,float...)
(in release mode that is),why can it happen?
You can invoke the debugger in release mode too. Trace that part of the program and see if an optomization setting is causing a problem.
It doesn't sound like my contention of the directories is the problem
Source code is MINE! Now that is entirely another situation, one that I approach quite differently. Twice in my career did I encounter such a situation, but in both cases they already owned the software and rights to code, all I was doing is porting to another platform or hardware environment.
Payments was usually in person because most work I did was local and implementation and training was part of the package so I had to be there physically anyway. I did have the opportunity to do one over the internet, but I just didn't like the situation so I bowed out.
I never put anymore into a project than I can afford to lose. I'm not advocating this is the best method, but there is an element of safety to it.
You may want to consider doing some small probono work. That's a really good way to get yourself known, after that's all an internship is in most cases
The way I do it is somewhat like Hamrick suggested -- create a project then change the source file(s) as needed. I test out many of the programs posted on the C and C++ boards that way.
I kind of overlooked the fact that maybe you want to run the app in some way. My method only compiles the file, nothing else.
so do you just do jobs and hope the person you are working with pays you like they said they would? is that generally how freelance works?
I can't speak to generality, only that is the way I do it and I've had a 95% success rate. Yes I've taken a bath on a few projects and one major one, but ask anyone that's in business and that's not abnormal. I apply one principal and that is to give the customer a quality product and most times they will pay without problem.
What I did in the beginning was to take on small projects that took no more than 3 months just to get my feet wet and then when the 6 year one presented itself I was well prepared and it did in fact turn out to be a very successful experience.
My personal preference was to spend my time coding and analysis, not writing contracts. Bottom line though, you probably won't find to many people in business that would undertake any sort of job without a contract, so it basically boils down to what are comfortable with. I'm sure if you're able to crank out a quality product your customer wouldn't object to a contract. Establishing a reputation is probably the most daunting thing when your breaking out, that pretty well applies to everything though.
I've been freelancing for 25 years and never had a contract. That being said though, there were quite a few problems in the beginning because I didn't have the experience to recognize disingenuous people. I have always though laid out a prospectus so there was never any confusion of the scope and purpose of the application or project. The only time I did insist on a contract was with a large medical institution where there were many departments and people were always being shuffled in an out of the project. Other than that, most of my work is with small businesses where I'm dealing directly with the person that's signing the cheque. That being said, one thing you can't deny is a contract is just an added measure of insurance if things go sideways.
When you open a single file in Visual Studio (VC 6.0++), what it will ask if you want to open an project workspace. That is just something it needs internally and doesn't actually create a project. Just click on yes and you can compile a single file.
I think its a 'big picture' issue that you shouldn't worry about too much for the moment. For small/toy programs while learning the language, or testing out a feature of the language, it really doesn't matter IMHO.
I concur, you will find that after writing a few hundred programs you will probably develop your own style. This is an example of how I use main in a windows application
int APIENTRY WinMain (HINSTANCE Instance, HINSTANCE PrevInst, char *CmdLine, int ShowValue)
{
MSG Msg;
hInst = Instance; // Global copy of instance handle.
// Create the main window and if everything was successful then fall into applications main
// message pump
if (CreateMainWindow (ShowValue))
{
Words.Create ("Glenda's Medical Words");
while (GetMessage (&Msg, NULL, 0, 0))
{
TranslateMessage (&Msg);
DispatchMessage (&Msg);
}
return Msg.wParam;
}
return 0;
}
Some of my applications are more elaborate depending on what's required for startup, but this does not mean I am any more or less correct than other methods. As Bench has said, I use the four variables passed by preamble and one of my own, so if you wanted to do your entire application in the main () block your free to do so.
In VC 6.0++ each of Debug & Release can have different settings for directories. Use ALT-F7 and check that the settings for each is the same
At which part of your code, displays the result, im confused on how you displayed the result.
Line 38 is where I start the display process. The trick you might be missing is after I convert each character I actually put it in the final display string. Use DEBUG and break at line 38 and just trace through it step by step and you'll get what's going on.
Ok, here's my version. Once again to characterize something as being right or wrong in programming is somewhat subjective. Correctness in my mind is if the application is doing what it's supposed to do. That being said, when I code I try to combine efficiency of memory and speed. In this case, even my example below does not meet that criteria, but non the less it gets the job done.
org 100h
lea dx, [StrA]
mov ah, 09h
int 21h
mov ah, 1
int 21h
and al, 15
mov cl, 4
shl ax, cl
mov dl, al
mov ah, 1
int 21h
and al, 15
add dl, al
push dx
lea dx, [StrB]
mov ah, 09h
int 21h
mov ah, 1
int 21h
and al, 15
mov cl, 4
shl ax, cl
mov dl, al
mov ah, 1
int 21h
and al, 15
add dl, al
pop ax
add al, dl
daa
push ax
and ax, 15
or al, 30H
mov [OutPut + 1], al
pop ax
shr ax, cl
and ax, 15
or al, 30H
mov [OutPut], al
lea dx, [Strc]
mov ah, 9
int 21H
ret
StrA db 10, 10, 10, 13, 'First Integer: $'
StrB db 13, 10, 'Second Integer: $'
Strc db 10, 10, 10, 13, 9, 'Sum is: '
OutPut db '00', 10, 10, 10, 13, '$'
There are a few subtle differences, especially as I code using NASM. Apart from that you'll figure out the rest. Notice how I incorporate carriage returns and line …
Let me see your code in its entirety so I can give specific details. In general your going to add your two numbers and then use DAA. Afterward you'll take that packed binary decimal and add 30H to it again to get ASCII equivalent