| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2570 人关注过本帖
标题:[求助]assignment makes pointer from integer without a ca ...
取消只看楼主 加入收藏
lzf0112
Rank: 1
等 级:新手上路
帖 子:244
专家分:0
注 册:2006-4-9
收藏
 问题点数:0 回复次数:1 
[求助]assignment makes pointer from integer without a cast

#include "stdio.h"
#include "filesys.h"
unsigned int read(user_id,fd_1,buf,size)
unsigned int user_id;
int fd_1;
char *buf;
unsigned int size;
{
unsigned long off;
int block,block_off,i,j,k;
struct inode *inode;
char temp_buf[size];
char *temp;

temp = temp_buf;

for(j=0;j<USERNUM;j++)
if(user[j].u_uid == user_id)
{
k=j;
break;
}


inode=sys_ofile[user[k].u_ofile[fd_1]].f_inode;
if(!(sys_ofile[user[k].u_ofile[fd_1]].f_flag&FREAD))
{ printf("\n the file is not opened for read\n");
return 0;
}

off=sys_ofile[user[k].u_ofile[fd_1]].f_off;
if((off+size)>inode->di_size)
size=inode->di_size-off;
block_off=off%BLOCKSIZ;
block=off/BLOCKSIZ;
if(block_off+size<BLOCKSIZ)
{
fseek(fd,DATASTART+inode->di_addr[block]*BLOCKSIZ+block_off,SEEK_SET);
fread(buf,1,size,fd);
sys_ofile[user[k].u_ofile[fd_1]].f_off+=size;//记录文件读写指针现在的偏移
return size;
}

fseek(fd,DATASTART+ inode->di_addr[block]*BLOCKSIZ+block_off,SEEK_SET);
fread(temp,1,BLOCKSIZ-block_off,fd);
temp+=BLOCKSIZ-block_off;

for(i=0;i<(size-(BLOCKSIZ-block_off))/BLOCKSIZ;i++)
{
fseek(fd,DATASTART+inode->di_addr[block+1+i]*BLOCKSIZ,SEEK_SET);
fread(temp,1,BLOCKSIZ,fd);
temp+=BLOCKSIZ;
}
block_off=(size-block_off)%BLOCKSIZ; //读最后一块
block=inode->di_addr[size/BLOCKSIZ+1];
fseek(fd,DATASTART+block*BLOCKSIZ,SEEK_SET);
fread(temp,1,block_off,fd);
sys_ofile[user[k].u_ofile[fd_1]].f_off+=size;

memcpy(buf,temp_buf,size);
return size;
}

编译时提示:assignment makes pointer from integer without a cast
各为帮忙看一下啊。。。

搜索更多相关主题的帖子: assignment pointer cast integer makes 
2006-12-25 21:47
lzf0112
Rank: 1
等 级:新手上路
帖 子:244
专家分:0
注 册:2006-4-9
收藏
得分:0 
路过的帮忙解决一下啊。。。。。。
2006-12-26 16:44
快速回复:[求助]assignment makes pointer from integer without a ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017053 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved