Exemplo n.º 1
0
/*
test2 cria um arquivo host com 8 blocos
e 2 arquivos
*/
void main(int argc, char *argv[]){
  cry_desc_t * descritor;
  indice_arquivo_t indice1;
  indice_arquivo_t indice2;
  initfs("host", 30);
  descritor = cry_openfs("host");
  char buffer[] = "babaca";
  char buffer2[] = "z";
  indice1 = cry_open(descritor,"arquivo1", ESCRITA, 'y');
  indice2 = cry_open(descritor,"arquivo2", ESCRITA, 'q');
  cry_write(indice1, sizeof(buffer), buffer);
  cry_write(indice2, sizeof(buffer2), buffer2);
  int del,del1;
  del = cry_close(indice1);
  del1 = cry_close(indice2);
  del =  cry_delete(indice1);
  del1 = cry_delete(indice2);
}
Exemplo n.º 2
0
int main() {
    cry_desc_t * descritor;
    indice_arquivo_t indice;
    initfs("arquivao", 5);
    descritor = cry_openfs("arquivao");
    indice = cry_open(descritor,"bunda",ESCRITA,'n');
    uint32_t tamanho;
    char *buffer = "vai se foder";
    char buffer2[8];
    cry_write(indice,sizeof(buffer),buffer);
    tamanho = cry_read(indice,8,buffer2);
    cry_close(indice);
    cry_delete(indice);
    return 0;
}
Exemplo n.º 3
0
void escreve(indice_arquivo_t arquivo, uint32_t tamanho){
	char *bufferEscrita;
	int i, retorno;
	char c;

	bufferEscrita = malloc(tamanho + 1);
	for(i = 0; i < tamanho; i++){
		c = 65 + (rand() % 26);
		bufferEscrita[i] = c;
	}
	bufferEscrita[i] = '\0';
	retorno = cry_write(arquivo, tamanho, bufferEscrita);
	assert(retorno != FALHA);
	free(bufferEscrita);
}