惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - Ethan_村长

自己开发iOS版按键精灵--TTouch iOS 基于OpenCV图像比较的常见方法 iOS越狱系统使用root权限运行命令 Mac CEF 支持mp3 mp4编译 iOS自动化测试需求实现(iOS按键精灵类似) [转]runtime 消息机制 [转]多线程 解决读取iphone名称中文乱码问题 windows或mac上对iOS设备截图 JPEG文件结构 ios获取左右眼图片景深图 使用libjpeg.framework压缩UIImage shell脚本删除指定mobileprovision iphone使用mac上的SOCKS代理 eclipse配置javah命令 [转]Android通过NDK调用JNI,使用opencv做本地c++代码开发配置方法 利用JNI技术在Android中调用、调试C++代码 iOS在线更新framework,使用NSBundle动态读取 CocoaPods pod install
Mac读取Andriod屏幕截图
Ethan_村长 · 2016-01-14 · via 博客园 - Ethan_村长
int main(int argc, const char * argv[]) {
    // insert code here...
    
    
    string str3 = "/Users/Ethan/Downloads/aaa/platform-tools/adb shell screencap -p";
    NSMutableData *resultData=[[NSMutableData alloc] init];
    FILE * fstream = NULL;

    if(NULL==(fstream=popen(str3.c_str(),"r")))
    {
        fprintf(stderr,"execute command failed: %s",strerror(errno));
        return NULL;
    }
    
   FILE *png = fopen("/var/folders/_g/mmsygkld2sv2pl719654cscm0000gn/T/2.png", "w");

    char tmp[1024]; //存储每一行输出
    size_t all=0;
    size_t readNum=fread(tmp,1, sizeof(tmp)-1, fstream);

    while (readNum!=0)
    {
       
        if (tmp[readNum-1] == 0xd)
        {
            tmp[readNum++] = fgetc(fstream);
        }
        
      
        for (unsigned int i = 0; i < readNum; ++i) {
            if (tmp[i] == 0xd && tmp[i+1] == 0xa ) {
                tmp[i] = 0xa;
                for (unsigned int j = i+1; j < readNum - 1; ++j)
                    tmp[j] = tmp[j+1];
                readNum--;
            }
        }
         all=all+readNum;
        
        //写到文件
        fwrite(tmp, 1, readNum, png);
        //直接放到内存
        [resultData appendBytes:tmp length:readNum];
       
        readNum=fread(tmp,1, sizeof(tmp)-1, fstream);
    }
 
   
    NSImage *img=[[NSImage alloc] initWithData:resultData];
    
    NSLog(@"%f",img.size.width);

   
  
    return 0;
}