W
Wavelet
want to parse the user inputed date format with strptime()
function in Linux.
For example,"12,17:30:20" will be explained as day 12, hour 17 etc.
And I want to get the exact day. I used the following code and it
works well in Solaris,but Segmentation fault in Linux.
Could someone help me out?
=============================================
#define _XOPEN_SOURCE /* glibc2 needs this */
#include <stdio.h>
#include <time.h>
int main() {
struct tm tm;
char buf[255];
strptime("12,17:30:20", "%d", &tm);
printf("ok here\n");
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
puts(buf);
return 0;
function in Linux.
For example,"12,17:30:20" will be explained as day 12, hour 17 etc.
And I want to get the exact day. I used the following code and it
works well in Solaris,but Segmentation fault in Linux.
Could someone help me out?
=============================================
#define _XOPEN_SOURCE /* glibc2 needs this */
#include <stdio.h>
#include <time.h>
int main() {
struct tm tm;
char buf[255];
strptime("12,17:30:20", "%d", &tm);
printf("ok here\n");
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
puts(buf);
return 0;