목적 C 언어 ->특정 어레이를 어떻게 출력합니까?
내가이있는 NSString에 그것을 읽고 배열, 즉 만들려는, CVS 파일이 : 20000
이름, 상태, 가격, 우편 번호
존, WI을 , 43,555 .. .. 나는 .cvs 파일에서 생성 배열에서 사용자의 입력에 따라 속성 이름이 어떻게 진행 것이다 출력 할 수 있도록 할
#import <Foundation/Foundation.h>
#import <string.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
//input user for a name on property list
int input;
NSLog(@"The worldcities.cvs contained infor on property names.");
NSLog(@"Enter a name: ");
scanf("%i", &input);
NSString *sourceFileString = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"filename" ofType:@"worldcities.csv"] encoding:NSUTF8StringEncoding error:nil];
NSMutableArray *csvArray = [[NSMutableArray alloc] init];
csvArray = [[sourceFileString componentsSeparatedByString:@"\n"] mutableCopy];
NSString *keysString = [csvArray objectAtIndex:0];
NSArray *keysArray = [keysString componentsSeparatedByString:@","];
[csvArray removeObjectAtIndex:0];
?
문제점을 설명하십시오. 필요한 출력은 무엇입니까? –
어떻게 사용자 입력을 기반으로 cvsArray에 저장된 배열을 출력합니까? 내 리그를 지난 – kid2222