suzy Posted June 22, 2008 at 03:26 PM Report Share #192836 Posted June 22, 2008 at 03:26 PM Caros quero ler um ficheiro de estruturas, usando o read, tenho de usar as system calls de unix fiz assim mas da erro, como faço? void lelistacontas (banco * b) { int le,total=0; conta p;// variavel do tipo conta printf(" A ler as contas do banco do ficheiro \n"); // vou abrir o ficheiro com permisoes de escrita se nao existir sera criado le=open(b->nomeficheirocontas,O_RDWR|O_CREAT_S,IWUSR); if(le==-1) { printf(" nao foi possivel ler o ficheiro\n"); exit(-1); } while(nread=read(le,p,sizeof(conta))==1) write(b->listacontas[total++],conta,nread);// nao sei se e assim } muito obrigada Link to comment Share on other sites More sharing options...
TheDark Posted June 22, 2008 at 04:12 PM Report Share #192842 Posted June 22, 2008 at 04:12 PM Que erros dá...? Desaparecido. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now