내 아이폰에있는 기존 sms.db 파일을 xcode 프로젝트로 가져온 수정 된 sms.db 파일로 바꾸고 싶습니다.xcode에서 가져온 .db 파일을 iphone으로 직접 이동하는 방법
"from"및 "to"매개 변수를 사용하는 cp() 함수가 있습니다. 나는 이런 식으로 실행하려면 :
cp('/path/within/xcode/project/sms-modified.db', '/var/mobile/Library/SMS/sms.db');
내가 엑스 코드에서 가져온 sms.db을 내 폰 안에 sms.db를 대체 할 수있는 아래의 기능을 수정하는 방법
?
int cp(const char *from, const char *to) {
int fd_to, fd_from;
char buf[4096];
ssize_t nread;
int saved_errno;
fd_from = open(from, O_RDONLY);
if (fd_from < 0)
return -1;
fd_to = open(to, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd_to < 0)
goto out_error;
while (nread = read(fd_from, buf, sizeof buf), nread > 0)
{
char *out_ptr = buf;
ssize_t nwritten;
do {
nwritten = write(fd_to, out_ptr, nread);
if (nwritten >= 0)
{
nread -= nwritten;
out_ptr += nwritten;
}
else if (errno != EINTR)
{
goto out_error;
}
} while (nread > 0);
}
if (nread == 0)
{
if (close(fd_to) < 0)
{
fd_to = -1;
goto out_error;
}
close(fd_from);
/* Success! */
return 0;
}
out_error:
saved_errno = errno;
close(fd_from);
if (fd_to >= 0)
close(fd_to);
errno = saved_errno;
return -1;
}
fopen? 어떤 프로그래밍 언어에 대해 이야기하고 있습니까? 기음? PHP? 누가 iOS 앱에서 macOS 파일에 직접 액세스 할 수 있다고 했습니까? –
C. 파일을 프로젝트로 가져 오면 어떻게 프로젝트에서 가져올 수 있습니까? – Rees
@ElTomato 질문이 업데이 트되었습니다 – Rees