![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does KSH support data type conversion? | joshuaduan | Shell Programming and Scripting | 2 | 06-26-2007 04:12 AM |
| Value too large to be stored in data type??? | limame | AIX | 5 | 06-18-2007 11:35 PM |
| data type limitation | ALTRUNVRSOFLN | High Level Programming | 2 | 11-01-2005 06:30 PM |
| FILE data type | milhan | High Level Programming | 6 | 01-28-2005 08:49 PM |
| gzip:Value too large for defined data type | dangral | UNIX for Dummies Questions & Answers | 1 | 10-14-2003 05:11 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Hi
I kind of understood the meaning for those two questions but just wanted to verify it. Here is the my real problem: When the below code running, sometimes the result of end-2 is greater than end -1, sometime it isn't. Does anyone know what could be the reason? Thanks a lot! ..... time_t start, end; ..... fprintf(out, "%-35s 55 %5s %2s %10d 1 5 /tty/M%d/%02d %24s", buffer3, job, ver, end - 2, mach_num,atoi(buffer), asctime(ptr)); fprintf(out, "%-35s 50 %5s %2s %10d 1 5 /tty/M%d/%02d %24s", buffer3, job, ver, (end - 1), mach_num,atoi(buffer), asctime(ptr)); |
|
|||||
|
seconds after 1970
No, there is no intervening lines between the two fprint() statements.
But this is this : ptr = localtime(&end); I know that this part of the code suppose to write to a log file format like below. But sometimes the number with blue color in the second line is lesser than the number with blue in the first line. The number should be the seconds after 1970. It happened randomlly. 6174 Name 55 20261 02 1110798898 1 5 /tty/M1/08 Mon Ma r 14 06:15:00 2005 6174 Name 50 20261 02 1110798002 1 5 /tty/M1/08 Mon Ma r 14 06:15:00 2005 =============================================== 5514 Name 55 00000 03 1126647298 1 5 /tty/M1/03 Tue Sep 13 17:35:00 2005 5514 Name 50 00000 03 1126647299 1 5 /tty/M1/03 Tue Sep 13 17:35:00 2005 Last edited by whatisthis; 09-15-2005 at 11:04 AM.. Reason: addition |
|
||||
|
Under some heavy-duty circumstances and with some versions of unix: the order that data is written to a file may not be preserved. We had an old DEC-unix box that did that. I don't know that this is what you are seeing, but it's possible. You can correct the problem with fflush(): Code:
fprintf(..........); fflush(out); fprintf(...........); This has nothing to do with C in particular. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|