I've been having a problem with a program that I can't seem to figure out why it isn't working, so I thought I would ask about it here.
This is a program written in C and is using the newest HP ANSI C compiler. Previously, this code was compiled using an older compiler and did not have any issues.
Basically, within the program, I am reading a value from a column into a string. I am then using atof() to store this string as a double. I'd rather it'd just be a float, but that's a separate issue I guess. The problem is, I checked it using a simple printf statement directly afterward and the double value appears to be a memory address(ie. - a very large integer) instead of the 3 decimal place double that it should be. I also tried converting straight from the read, skipping the interim string variable and got the same result.
Am I doing something wrong with this? Should I be accessing something as a pointer and I'm not?
This is a program written in C and is using the newest HP ANSI C compiler. Previously, this code was compiled using an older compiler and did not have any issues.
Basically, within the program, I am reading a value from a column into a string. I am then using atof() to store this string as a double. I'd rather it'd just be a float, but that's a separate issue I guess. The problem is, I checked it using a simple printf statement directly afterward and the double value appears to be a memory address(ie. - a very large integer) instead of the 3 decimal place double that it should be. I also tried converting straight from the read, skipping the interim string variable and got the same result.
Am I doing something wrong with this? Should I be accessing something as a pointer and I'm not?