Logic4Fun,
From the code posted earlier it appears as if you assume that a line will have a maximum of 1027 chars. If there is more than 1027 chars in the line the code will treat it as more than one line. This may not be what you want.
A second thing is that fgets reads 1 less byte than what...
From the man pages :
int fflush (Stream)
...
Parameters
Stream Specifies the output stream
From borland c++ :
If the given stream has buffered output fflush writes the output for stream to the associated file.
It is only in Visual C++ that it is specified that it will clear the input...
Do not use string = "124.35". Use strcpy(string, "124.35"). For char[] and char* you have to use strcpy, strncpy, memcpy or memmove. That should solve your problem.
To convert float to char[] use sprintf :
sprintf(string, "%f", 124.34);
...
char fileName[15];
sprintf(fileName,"%04d%02d%02d", loc_time.tm_year, loc_time.tm_mon, loc_time.tm_mday);
fp = fopen(fileName, "w");
...
Ex. the file will be named "20020807".
Try using the following awk :
cat infile | awk '{while (sub("/usr/local/mrtg-2/bin//mrtg","/usr/bin/mrtg",$0)==1); print($0)}' >outfile
My program is receiving a lot of signal 20 (SIGCHLD), but has no children. When I run the program on a different box, I don't receive any signals. I am trying to find out where the signals originate from. I can block the signals, but then I will never know what causes it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.