真爱无限的知识驿站

学习积累技术经验,提升自身能力

linux c定位读取数据pread

code:

#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
int a=6666;
main()
{
char filename[100];
int fd;
int data;
sprintf(filename,"/proc/%d/mem",getpid());//本程序虚拟内存文件
fd=open(filename,O_RDWR);
if(fd==-1) printf("open error:%m
"),exit(-1);
pread(fd,&data,4,(off_t)&a);//从虚拟内存的相同地址中,读取实际地址位置相同的数据到data中
//pread() = lseek()+read()
//lseek(fd,(off_t)&a,SEEK_SET);
//read(fd,&data,4);   
printf("%d
",data);
close(fd);
}


asp.net调用飞信免费发短信

之前用过一段时间,已经证实不能再用!

        #region 免费发送飞们接口(2014-01-06 16:20测试有效)
        /// <summary>
        /// 免费发送飞们接口(要开通飞信把对方加为好友才能发,也可以给自己发做测试)
        /// </summary>
        /// <param name="sendNumber">登陆飞信手机号</param>
        /// <param name="sendPassword">登陆密码</param>
        /// <param name="receiveNumber">接收手机</param>
        /// <param name="Content">短信内容</param>
        /// <returns></returns>
        public bool sendfetion(string sendNumber, string sendPassword, string receiveNumber, string Content)
        {
            string url = string.Format("https://quanapi.sinaapp.com/fetion.php?u={0}&p={1}&to={2}&m={3}", sendNumber, sendPassword, receiveNumber, HttpUtility.UrlEncode(Content));
            string strRet = "";
            try
            {
                HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(url);
                hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
                hr.Method = "GET";
                hr.Timeout = 30 * 60 * 1000;
                WebResponse hs = hr.GetResponse();
                Stream sr = hs.GetResponseStream();
                StreamReader ser = new StreamReader(sr, Encoding.Default);
                strRet = ser.ReadToEnd();
            }
            catch (Exception er)
            {
                strRet = "";
            }
            if (!strRet.Contains(":0")) return false;//成功时返回数据:{"result":0,"message":"u53d1u9001u6210u529f"}
            return true;
        } 
        #endregion


asp.net两种方式的短信接口使用(提供接口的都是收费的)

一种是http请求的方式,另一种就是提供WebService接口供调用的。


asp.net中缓存类DataCache(依赖文件缓存和时间缓存,或两者)


更新:2013-12-29

<< 1 >>

Powered By Z-BlogPHP 1.7.3

Copyright 2024-2027 pukuimin Rights Reserved.
粤ICP备17100155号