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

推荐订阅源

N
News and Events Feed by Topic
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
Jina AI
Jina AI
H
Help Net Security
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
L
LangChain Blog
Recorded Future
Recorded Future
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
GbyAI
GbyAI
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
M
MIT News - Artificial intelligence
爱范儿
爱范儿
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Y
Y Combinator Blog
B
Blog
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
MongoDB | Blog
MongoDB | Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
The Cloudflare Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
D
DataBreaches.Net
博客园 - 【当耐特】
T
Troy Hunt's Blog
V
Visual Studio Blog
V2EX - 技术
V2EX - 技术
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google Online Security Blog
Google Online Security Blog
The GitHub Blog
The GitHub 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;
}