Linux 6RD HOWTO
如何在IPv4與IPv6共存下連線
IPv6 Forum Taiwan
Comcast 6RD - IPv6 Information Center
RFC 5969 - IPv6 6RD
2012 全球 IPv6 高峰會議
中華電信研究所IPv6測試實驗室
IPv6測試
IPv6實用技術手冊
Routers support IPv6
Top 5 IPv6-ready Wireless Routers
2012年10月29日 星期一
2012年10月24日 星期三
2012年10月17日 星期三
2012年10月16日 星期二
[iOS] iOS 6 - Contact's Privacy
Programmatically Request Access to Contacts in iOS 6
iOS 6 Address Book not working?
How do I correctly use ABAddressBookCreateWithOptions method in iOS6?
iOS 6 Address Book not working?
How do I correctly use ABAddressBookCreateWithOptions method in iOS6?
Request Permission
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
// Do whatever you need.
});
}
2012年10月3日 星期三
[Programming] scanf()
Issue: scanf() by char or string goes wrong result.
Solution1: Discard the last character "\n" by "%*c".
Solution3: Read out the "\n" by getchar();
#include <stdio.h>
int main(int argc, char **argv)
{
int valA;
char valB;
scanf ("%d", &valA);
printf ("valA=%d\n", valA);
scanf ("%c", &valB);
printf ("valB=%c\n", valB);
return 0;
}
Result:
3
valA=3
valB=
Expect result:
3
valA=3
4
valB=4
Reason: scanf() doesn't handle new line character, "\n".
Solution1: Discard the last character "\n" by "%*c".
#include <stdio.h>
int main(int argc, char **argv)
{
int valA;
char valB;
scanf ("%d%*c", &valA);
printf ("valA=%d\n", valA);
scanf ("%c%*c", &valB);
printf ("valB=%c\n", valB);
return 0;
}
Solution2: Add a space character to second scanf().
#include <stdio.h>
int main(int argc, char **argv)
{
int valA;
char valB;
scanf ("%d", &valA);
printf ("valA=%d\n", valA);
scanf (" %c", &valB); // It is " %c". There is a space character in front of %c.
printf ("valB=%c\n", valB);
return 0;
}
Solution3: Read out the "\n" by getchar();
#include <stdio.h>
int main(int argc, char **argv)
{
int valA;
char valB;
scanf ("%d", &valA);
getchar();
printf ("valA=%d\n", valA);
scanf ("%c", &valB);
getchar();
printf ("valB=%c\n", valB);
return 0;
}
訂閱:
文章 (Atom)