So you're saying it works on *some* Windows XP machines but not on
all. If it works on *any* Windows XP machines then that means the
executable is indeed "binary compatible" with Windows XP.
On the computer where it doesn't work, click the Start button and then
click Run. Type in "cmd" and hit Return. Use "cd" to navigate to the
directory that contains the executable, then type the name of the
executable and hit Return. There might be some text written to the
screen to indicate that an error has occurred.
If you have access to one of the machines on which it doesn't work,
you can use a debugger such as gdb to single-step through the program
until the point at which it fails.
Some things come to mind though:
1) The machines on which it doesn't work might be "newer" in that they
have service packs installed. These service packs might have security
features that kill a program when it does certain things.
If it's a small program, you can post the source code here and some of
us might be able to point out something that could be causing a
problem.
Here's the code: I am by no means a highly-skilled C programmer, but
there just isn't much in this program to go wrong. Another thing
worth noting is that the program doesn't run at all on some machines.
I'm not saying it fails to run, because that would mean the code
stopped somewhere. In this case, it is like the computer doesn't
even know it's there.
/* --- The following code comes from C:\lcc\lib\wizard\textmode.tpl.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
double amount,down,payment,pay_m,taxes,tax_m,insurance,ins_m,
extra,borrowed,num,den,years,months,T,interest,int_m,principal_pay;
double balance[1000], total_int[1000],inputs[6];
char x,name[80],printname[]={"notepad.exe "};
int n,count=1,k,flag;
void prog_header(void);
void print_results(void);
void print_file(void);
FILE *fp;
double get_values(double arg[]);
int main(void)
{
system("CLS");
prog_header();
restart:
n=0;
k=0;
amount=0;
down=0;
interest=0;
taxes=0;
months=0;
extra=0;
printf("\n\nEnter name of output file (no spaces): ");
scanf(" %s",&name);
//fgets(name,20,stdin);
strcat(name,".txt");
printf("Enter full purchase price: $");
scanf(" %lf",&amount);
printf("Enter downpayment: $");
scanf(" %lf",&down);
printf("Enter annual interest rate (as percent not decimal): ");
scanf(" %lf",&interest);
printf("Enter annual taxes & insurance: $");
scanf(" %lf",&taxes);
printf("Enter life of loan (months): " );
scanf(" %lf",&months);
//printf("Enter extra payment per month: " );
//scanf(" %lf",&extra);
tax_m=taxes/12;
borrowed=amount-down;
int_m=interest/1200;
pay_m=(int_m*borrowed)/(1-pow((1+int_m),-months))+tax_m;
principal_pay=pay_m-tax_m;
T=0;
balance[0]=borrowed;
for(n=1;n<=months;n++)
{
balance[n]=(1+int_m)*balance[n-1]-pay_m+tax_m;
total_int[n]=balance[n-1]*int_m;
T=T+total_int[n];
}
print_results();
print_file();
printf("\n\n\n\n\n");
printf("What do you want to do?");
printf("\n\n[1] Enter another loan\n[2] View output file\n[3] Quit
Program\n\t");
scanf("%i",&flag);
if(flag==1)
{
system("CLS");
goto restart;
}
if(flag==2)
{
strcat(printname,name);
system("CLS");
printf("\nOpening %s\n\n",printname);
system(printname);
system("PAUSE");
}
}
void prog_header(void)
{
printf("\n\n * * * LOAN PAYMENT CALCULATOR * * * \n\n");
printf("\nThis program will do the following....");
printf("\n\n [1] This will determine how large your monthly loan
payments will be");
printf("\n [2] Total amount of interest paid during the life of the
loan.");
printf("\n [3] Create an amortization schedule for the life of the
loan.");
printf("\n [4] Enter 0 for taxes and insurance to see pure loan
results.");
}
void print_results(void)
{
printf("\n\n\n RESULTS \n");
printf(" --------------------------------------- ");
printf("\n\t Filename: %s",name);
printf("\n\t Amount of loan: $%0.2f",borrowed);
printf("\n\t Interest rate: %1.4f%%",interest);
printf("\n\t Monthly payment: $%.2f",pay_m);
printf("\n\t Annual Taxes/Ins: $%.2f",taxes);
printf("\n\t Total interest paid: $%.2f",T);
printf("\n\t Total to be paid back: $%.2f",T+amount);
}
void print_file(void)
{
double cum_int,cum_pay,cum_pri,cum_tax;
fp=fopen(name,"w");
fprintf(fp,"\n********************************************");
fprintf(fp,"\n Loan Amortization Schedule");
fprintf(fp,"\n********************************************\n\n");
fprintf(fp, "Filename: %s\n",name);
fprintf(fp, "Purchase Amount: $%.2f\n",amount);
fprintf(fp, "Down payment: $%.2f\n",down);
fprintf(fp, "Loan Amount: $%.2f\n",borrowed);
fprintf(fp, "Loan Duration: %.0f months\n",months);
fprintf(fp, "Interest rate: %1.4f%%\n",interest);
fprintf(fp, "Annual Taxes/Ins.: $%1.2f\n",taxes);
fprintf(fp, "Monthly payment: $%.2f\n",pay_m);
fprintf(fp, "Total interest paid: $%.2f\n\n\n",T);
fprintf(fp, "Payment Payment Interest Tax/Ins
Principal Remaining Cumulative Cumulative
Cumulative\n");
fprintf(fp, "Number Amount Paid Paid
Paid Balance Interest Principal Tax and
Ins.\n");
fprintf
(fp,"---------------------------------------------------------------------------------------------------------------------
\n");
cum_int=0;
cum_pay=0;
cum_pri=0;
for(n=1;n<=months;n++)
{
cum_int=cum_int+total_int[n];
cum_pay=cum_pay+pay_m; // sum of all payments
cum_tax=tax_m*n;
cum_pri=pay_m*n-tax_m*n-cum_int;
fprintf(fp,"%3d %11.2f %11.2f %11.2f %13.2f %14.2f %14.2f %14.2f
%14.2f\n", n,pay_m,total_int[n],tax_m,pay_m-total_int[n]-tax_m,balance
[n],cum_int,cum_pri,cum_tax);
}
fclose(fp);
}