![]() |
|
#1
|
|||
|
|||
conflict between printf and stdarg.h va functionsHi!
I think C is having some conflict between printf and the stdarg.h va functions. Intro: I am calling a function called zone() within a program. zone() uses the va_start, va_arg, va_end, etc. functions in stdarg.h. These functions are also used by printf functions. Issue: If I comment out a simple print statement from the main program, the main program works fine. If I leave the statement in, for some reason the function zone() in gets confused…. Even though zone() is called with 5 arguments within the main C program, it sees 6 arguments, the last one being coincidentally the last argument of the print statement. I know that the printf/scanf functions use the variable argument functions used by zone(), so I believe somehow the last element of the print statement is staying in memory the next time the va functions are used. Is there any reason for this or any workaround? Thanks, Michelle |
|||
|
#2
|
||||
|
||||
|
Quote:
I have never had that problem in similar situations where I have used the va_arg functions. Is there a chance that you can post your zone function and perhaps the pertinent call? __________________
The best damn Sports Blog period. |
|
#3
|
||||
|
||||
|
Quote:
Sounds to me like the wayward pointer problem -- a pointer that's not really what you think it is. You may have to post the entire function that calls zone(), not just the call. __________________
Definition: Politics Latin, from poly meaning many and tics meaning blood sucking parasites -- Tom Smothers |
|
#4
|
|||
|
|||
|
Hi!
Files are attached below. If I comment uncomment out lines 154-156 in file1.txt, the function zone() in file2.txt sees "S12D_capacity" as a 6th argument. Any help would be greatly appreciated. Michelle |
Recent GIDBlog
Planned Network Maintenance on 2013-05-29 by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The