Will it cause any problems if the space is after the string like below?
"23.345 "
Type: Posts; User: cjohnman
Will it cause any problems if the space is after the string like below?
"23.345 "
I thought if atof was used on a string containing spaces it would not work. I have inserted spaces before the string and after. The atof still converts the string to a double. Is that everyone elses...
As always...
Thanks Todd!!
char hardness[256];
char *first_nonblank;
double hardness2;
/* int num_spaces = 0; */
strcpy(hardness," 23.345");
first_nonblank = hardness;
if...
I applied that to my code shown below. I need to do some tuning.. not working yet. Anything stick out as problem? The only drawback is I will have to reinitialize the variable prior to each while...
I just realized I need to discard the first space if one exists but if more than one exists do some error handling. So I only want the value if no space exists or if one exists. Other than that break...
I plugged your simplified version of Todds code in and it worked great! Thanks for your feedback. If there was more than one space this would work and no worrys about memory leak right?
The following works great thanks to Tod's help!
char hardness[256];
char *first_nonblank;
double hardness2;
strcpy(hardness,"23.345");
first_nonblank = hardness;
char hardness[256];
char *first_nonblank;
double hardness2;
strcpy(hardness,"23.345");
first_nonblank = hardness;
while (*first_nonblank)
{
if...
Thanks for pointing out some improvements for my existing code. I will look into making those changes. I plugged the code above in this morning and it works but I am seeing the space in my printf and...
I have some embedded sql code that reads data from a sql database and inserts the data into a ingres isql database. That works fine. My problem lies in the code when I use atof to convert a character...
I found the problem and it ended up being the format of a field on an abf form. I now have a bigger problem on my hand due to dependencies. It is converting a varchar 25 column from the db into...
It appears my date is changed by this function call. Do you think its possible this function would change a date from 12-May-2008 to 12-may-2008? I am trying to debug now.
if (!rt_stat)
...
Todd thanks for your help. I was thinkin that would work but I have been told to find where the problem originates and correct it there. Are you thinking I should do an update in the 4GL file where...
This date comes from a database column called entry_dt_tm and then the 4gl file trys to reset this date based on certain events. Thats where the problem lies because it just seems to call this...
ff_time is a struct:
[code]
77 struct tm ff_time;
78
79 int rt_stat,tmp_year;
80 char tmp_mon[4], tmp_date[13],tmp_time[9];
[\code]
And the purpose of...
I will need to find what ff_time.tm_mon = 0,1,2.... means? I am thinking based on your replys I should find in a header file something stating if ff_time.tm_mon = 0
0 is somehow = jan
Is this...
I have a function that is changing the first letter in the month to lower case and I want to make a change that stops this from occuring. I believe I found a if statement that is making this change....
memset((char *) &ordr_mstr,'\0',sizeof(struct ordr_mstr_));
Thanks for your help! What a clumsy mistake.
Thanks I made the correction below:
aa = swap2(aa);
printf("%d is aa now\n", aa);
bb = swap2(bb);
printf("%d is bb now\n", aa);
I am trying to compare how different functions work and I do not see whats wrong here. I expect to see 100 and 200 on the printf after the second function call and I get 2...2 no matter what I do...
If I dont free stanford (which I will always do) what are some of the problems that could occur? Also if I did not check for null and memory was not available what type of problems could arise?...
That works great and I will check for null as you advised.
How can I use malloc to create memory instead of assigning the pointer below to an instance of this struct?
struct fraction {
int numerator;
int denominator;
...