Floating point formats not linked.Code:int main() { int pgm; char inbuf [130]; printf("Input file: "); gets(inbuf); scanf(inbuf, &pgm); system("&pgm"); return 0; }
Abnormal program termination.
Where's the mix up?
Floating point formats not linked.Code:int main() { int pgm; char inbuf [130]; printf("Input file: "); gets(inbuf); scanf(inbuf, &pgm); system("&pgm"); return 0; }
Abnormal program termination.
Where's the mix up?
The world is waiting. I must leave you now.
What exactly are you trying to do?
1) gets(inbuf);
Never ever use gets.
2) scanf(inbuf, &pgm);
Again, what exacatly are you doing?
Do you know how to use scanf?
scanf( thisformat, thisvariable )
so, unless you're inputting like ... "%d""200" ... then your program won't work.
3) system("&pgm");
You realize that you're passing the string "&pgm" to your OS? Do you actually have a program called "&pgm" on your computer? If not, then this is not what you want. I will bet you any amount of money you want that this is not what you want.
4) return 0;
Hey, at least you have that right...
Quzah.
Hope is the first step on the road to disappointment.
Yes, I do. Programming is something I probably shouldn't be doing right now ( bare with me lol ). Yeah though, I want to pass whatever the use types ( whatever ) to the operating system.I will bet you any amount of money you want that
The world is waiting. I must leave you now.
> Yeah though, I want to pass whatever the use types (
> whatever ) to the operating system.
Which is not what you're doing. You're passing a string that is "&pgm". "&pgm" is nothing. It's not a variable. It's not the address of a variable. It's simply a string containing 4 characters (pluss null).
Assuming you read into a character array, called 'foo', you'd do:
system( foo );
The name of an array may be treated as a pointer. Thus, a character array who's name is 'foo', may be used as a pointer.
Quzah.
Hope is the first step on the road to disappointment.