0

I have tried to fetch /etc/resolv.conf by open("/etc/resolv.conf", 0644)

but it return -1 and the errno is 2 which means "no such file"

what can I do?

Gary
  • 1
  • 1
  • I would have guessed that there was no such file on your system. But then I don't know how accurate Apple error messages are. I know for a fact that Microsoft error codes are usually completely unrelated to the actual error encountered. – PP. Jun 04 '10 at 09:24
  • See http://stackoverflow.com/questions/10999612/iphone-get-3g-dns-host-name-and-ip-address – AriX Jul 20 '12 at 23:01

1 Answers1

3

You can't access files outside your Application's sandbox.

Jasarien
  • 58,279
  • 31
  • 157
  • 188
  • We have a winner! Apple is lying to you! The file exists but you don't have access! What is worse than no error message? A dishonest error message! – PP. Jun 04 '10 at 10:05
  • @PP Sure, Apples engineers have explicitly added this "wrong" error code for this particular device OS. – bddckr Jun 04 '10 at 10:11
  • There's no indication that the message is dishonest or even wrong. It might just be omitting some salient information. "There is no such file" is what the error says, but the non-truncated message could actually be "There is no such file available to you". – Jasarien Jun 04 '10 at 13:23
  • are there any solution to get dns server ip on iphone app? – Gary Jun 07 '10 at 07:18