a nice code!
btw,
I am looking for a way that how to set system date...
For example, now is 05/07/2008 00:49:53, I want to set datetime to 06/07/2008 00:49:53. that change date without modifing time.
first , I use the popen to run the system command "date" in my program, but it can't change date without modifing time. And it will lost the second info of time...
by Hunter — May 06
btw,
I am looking for a way that how to set system date...
For example, now is 05/07/2008 00:49:53, I want to set datetime to 06/07/2008 00:49:53. that change date without modifing time.
first , I use the popen to run the system command "date" in my program, but it can't change date without modifing time. And it will lost the second info of time...
such as:
NSString *output = [NSString string];
NSString *cmd = [NSString stringWithFormat:@"date 060700492008"];
NSLog(@"exec cmd:%@",cmd);
FILE *pipe = popen([cmd cStringUsingEncoding: NSASCIIStringEncoding], "r");
if (!pipe) return -1;
char buf[1024];
while(fgets(buf, 1024, pipe)) {
output = [output stringByAppendingFormat: @"%s", buf];
}
pclose(pipe);
Is there another way to do that?
help me T_T