是否可以在没有时间和日期戳的情况下使用NSLog()以及自动换行符? [英] Is it possible to NSLog() without the time and date stamps, and the automatic newline?

查看:70
本文介绍了是否可以在没有时间和日期戳的情况下使用NSLog()以及自动换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSLog()是否具有不带时间和日期戳以及自动换行符打印的变体?

Does NSLog() have variants that print without the time and date stamps, and the automatic newline?

谢谢.现在,使用以下代码,我可以打印NSString,cString或对象:

Thanks. Now with following code, I can print NSString, cString, or objects:

#import <Foundation/Foundation.h>
#import <stdio.h>

int main (int argc, const char * argv[]) {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

  NSString *s = @"Hello, World!";
  NSDate *today = [NSDate date];

  NSLog(@"%@", s);
  printf("%s at %s", [s UTF8String], [[today description] UTF8String]);

  [pool drain];
  return 0;
}  

推荐答案

使用printf()代替NSLog()

这篇关于是否可以在没有时间和日期戳的情况下使用NSLog()以及自动换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆