![]() |
|
#1
|
|||
|
|||
Strange problem when I try to print a value?Hello,
first method --------------------------------------------------------------- CPP / C++ / C Code:
The program will call transmit method first, then pyhsical_ready method. The problem is when I try to display the frame_counter, is always 1. I have increment the frame_counter on ther first method. instead frame_counter is global variable. I do not know why it always print zero on pyhsical_ready method, but it's find when i try to print from other method? Any Ideas Guys what wrong with that... Thank's Last edited by dsmith : 13-May-2004 at 07:05.
Reason: Please enclose your c code in [c] & [/c]
|
|
#2
|
||||
|
||||
|
Hello 7eleven.
I don't exactly follow your code, but I do have a question. Why have you defined a global as static? Have you tried not defining this as static. Global variables are implicitly static and adding the word static may be doing something else. This is from MSDN and I don't exactly understand what it means by internal linkage, but the rest is pretty straight forward Quote:
I don't know if this helps, but if you aren't positive that the global variable should be a "static int", try it with just "int" and see if that helps. Cheers, d |
|
#3
|
|||
|
|||
|
When I see programs using global variables, I ask, "Why?" Are there lots of routines that access frame_counter, and you just didn't want to use it as an argument, or what? Are you sure that no other functions have modified frame_counter?
Here's an example that successfully does what I think you are attempting. Note that, for debug purposes, I put printf() statements in certain places that allow me to see what's happening to the variable in question. You can do the same. CPP / C++ / C Code:
Regards, Dave |
Recent GIDBlog
Toyota - 2008 August Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you print a web page? | rhino1616 | Web Design Forum | 10 | 30-Jul-2004 23:25 |
| Another FX 5600 problem (but with details that might shed light on this) | BobDaDuck | Computer Hardware Forum | 2 | 16-Apr-2004 07:53 |
| unwanted scrollbar problem | kelly001 | Web Design Forum | 3 | 24-Oct-2003 10:44 |
| Guestbook error | BobbyDouglas | Web Design Forum | 1 | 16-Oct-2003 22:17 |
| select problem | zuzupus | MySQL / PHP Forum | 0 | 15-Aug-2003 07:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The