Chinaunix首页 | 论坛 | 博客
  • 博客访问: 532711
  • 博文数量: 150
  • 博客积分: 5010
  • 博客等级: 大校
  • 技术积分: 1861
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-17 00:19
文章分类

全部博文(150)

文章存档

2011年(1)

2009年(14)

2008年(135)

我的朋友

分类: LINUX

2008-08-06 18:46:58

比较复杂:首先其偏移在offset =0位置,还用到了一个配置文件,nvm_config.txt,要读取其中的一个值,

void tc_RF_operation( )
{
   
   char temp[40*1024];
   long     offset;
   UINT32 length;
   UINT32 ret_len;
   int nvm_fd;
   char nvm_flag;
   
   FILE *fp     = NULL;
   length= sizeof(temp);
   offset=0;
 
   TCMD_TRACE("The length is %d: \n",length);
   memset(temp,0,length);

   nvm_fd = open("/telephony/tel/NVM/nvm_config.txt", O_RDWR);
   read(nvm_fd,&nvm_flag,1);
   close(nvm_fd);

    if(nvm_flag=='0')
    {
        LoadBackNVM(temp,length,offset);
        if(lenBackNVM>1024*10)
        {
            fp = fopen( "/data/telephony/nvm/GsmCalData.nvm", "w" );
            if(fp!=NULL)
            {
                ret_len = fwrite(temp,1,lenBackNVM,fp);
                TCMD_TRACE("the real write length is %d: \n",ret_len);    
                nvm_flag='1';
                nvm_fd = open("/telephony/tel/nvm_config.txt", O_RDWR);
                write(nvm_fd,&nvm_flag,1);
                close(nvm_fd);
            }
            else
            {
                TCMD_TRACE("Error operarion the fileeeee \n");
            }
     
            fclose(fp);
            
        }
          
    }
                
   
   

}

阅读(1092) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~