Hi,
I am working on a Solaris server and have a piece of C code that is meant to read in a text file that contains an integer and it should then increment the integer by 1, use it and then write the new value to the text file.
My code has:
FILE *uniq_id_file; -- this line is declared near the top of the file after the #include section
int number = 0;
int gcount = 0;
uniq_id_file = fopen("/vobs/src/tool/uniqid", "rb");
while((number=getw(uniq_id_file))!=EOF)
{
printf("number is: %d\n",number);
gcount = number;
printf("gcount is: %d\n",gcount);
}
fclose (uniq_id_file);
My file uniqid has the single entry 9000 in it. When I run my C program the printf's are displaying:
Main number is: 959459386
Main gcount is: 959459386
Why is this?
How can I get it to assign the actual value of uniqid to gcount?
Thanks,
toddyl
I am working on a Solaris server and have a piece of C code that is meant to read in a text file that contains an integer and it should then increment the integer by 1, use it and then write the new value to the text file.
My code has:
FILE *uniq_id_file; -- this line is declared near the top of the file after the #include section
int number = 0;
int gcount = 0;
uniq_id_file = fopen("/vobs/src/tool/uniqid", "rb");
while((number=getw(uniq_id_file))!=EOF)
{
printf("number is: %d\n",number);
gcount = number;
printf("gcount is: %d\n",gcount);
}
fclose (uniq_id_file);
My file uniqid has the single entry 9000 in it. When I run my C program the printf's are displaying:
Main number is: 959459386
Main gcount is: 959459386
Why is this?
How can I get it to assign the actual value of uniqid to gcount?
Thanks,
toddyl