laserlight, I know what you mean but like you said:
If you cannot adequately communicate what you're trying to do in English
But It’s near the same if someone said:
If you cannot adequately communicate what you're trying to say in English
You either say day for day and night for night. Midnight is night is the middle of the night.
Please don’t be angry.
crontab guru Wow! I can't wait!
stahta01, good point. I use FreeBSD-10.1 and Debian Jessie Linux. Neither is broke and I'm not going to fix it.
awsdert, you woke me up. The Windows scheduler. It lead me to the cron-scheduler (strange name):
Cron Scheduler Service for Complex Cron Jobs - PipeGears so it is possible.
There are times when one have no choice but to try to explain things the best way he can. I never did this before, check any of my previous threads. My choice was to rip my program apart with pathnames seven or more links deep, or to tell it like it was and hope for the best. I tried to rip but jacked everything up, then I put it back together. I was burn-up burnout.
It took me 4 days to finally post what I wrote 4 days before fearing that I may have said the wrong thing or too much. Now it’s full of type-o, caps and missing words. There is no excuse, it's just the truth. I just kelp reading, guessing, and testing for days with no success. This is what I do but it did not work for me this time. We all make mistakes.
Anyway, now I know for a fact it was something I was doing wrong.
I know this is a professional forum. I will do as much as possilbe to make things cleaner and clearer in the future Thanks Salem
Seems the same. It took me a while to find and use fscanf. This code itself could have been part of my problem. Thank Goodness I now have the opportunity to find out sooner than latter.
Code:
// over 10 digits I saw problems, so there may be weakness somewhere much deeper.
// Adjust to any size below 10 digits seems ok.
// The code to big and it need to use buffers.
//
// weather_id.txt 1000000001
// weather_id.c This file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addTo(int x);
int num = 0;
int sum = 0;
char str[11];
int main() {
// #################################################### update ID
// ####################################################
FILE *fr, *fw;
fr=fopen("/AUTO_ID/weather_id.txt","r");
fw=fopen("/AUTO_ID/tmp.txt","w");
fscanf(fr, "%d\n", &num);
sum = addTo(num);
sprintf( str, "%d", sum );
fflush(stdout);
fputs(str, fw);
fclose(fr);
fclose(fw);
fw=fopen("/AUTO_ID/weather_id.txt","w"); fclose(fw);
// ......................................................
// ...................................................... Complete the ID file
// ......................................................
fr=fopen("/AUTO_ID/tmp.txt","r");
fw=fopen("/AUTO_ID/weather_id.txt","w");
char ch;
int pos;
fseek(fr, 0L, SEEK_END);
pos = ftell(fr);
fseek(fr, 0L, SEEK_SET);
while (pos--)
{
ch = fgetc(fr);
fputc(ch, fw); }
fclose(fr);
fclose(fw);
fw=fopen("/AUTO_ID/tmp.txt","w"); fclose(fw);
return 0;
}
/** ........................................... */
/** ........ MATH - ADD A NUMBER ........ */
/** ........................................... */
int addTo(int x)
{
int m = 1; /** add upto any amount */
while( x & m ) /** flip bits to find 0 */
{ x = x ^ m;
m <<= 1; }
x = x ^ m; /** flip rightmost 0 bit */
return x; }