SphereExample(void) : vs(make_vs()) , proton(vs,make_fs(fs_proton())) , neutron(vs,make_fs(fs_neutron())) , electron(vs,make_fs(fs_electron())) { gl.ClearColor(0.3f, 0.3f, 0.3f, 0.0f); gl.ClearDepth(1.0f); gl.Enable(Capability::DepthTest); }
ShapeExample(void) : vs(make_vs()) , sphere(vs,make_fs(fs_yb_strips(), "Y/B strips")) , cubeX(vs, make_fs(fs_bw_checker(), "B/W checker")) , cubeY(vs, make_fs(fs_br_circles(), "B/R circles")) , cubeZ(vs, make_fs(fs_wg_spirals(), "W/G spirals")) , torus(vs, make_fs(fs_wo_vstrips(), "W/O vstrips")) { gl.ClearColor(0.5f, 0.5f, 0.5f, 0.0f); gl.ClearDepth(1.0f); gl.Enable(Capability::DepthTest); }
fileSys::fileSys(Pdisk& dsk){ disk = dsk; bool flag = false; char tmp; string dat = disk.getDiskName()+".dat"; init(); ifstream file; file.open(dat.c_str()); file.seekg(disk.getBlockSize()-1); for(int i=disk.getBlockSize(); i < (2*disk.getBlockSize()); i++) { file.get(tmp); if(tmp != '#'){ flag = true; break; } } if(flag == true){ // data was found load fs load_fs(); }else{//data was not found make_fs(); fsSynch(); } file.close(); }
int main(int argc, char *argv[]) { make_fs("test"); mount_fs("test"); fs_create("myfile.txt"); fs_list_files(); fs_create("junk.txt"); fs_list_files(); int fd = fs_open("myfile.txt"); char *buf = "testing this code"; fs_write(fd,buf,strlen(buf)); //fs_lseek(fd,100); buf = "it! Blahc lksjdfkj ihwtw lekjth lksajdf 123413459827 i sadfkjhq3oipu4tryheiq8u934yt5981 3yq4t97ughergo9vyq398 4y5t 98qgrebgfvkje"; fs_write(fd,buf,strlen(buf)+1); //fs_truncate(fd,2); //fs_write(fd,"",1); fs_close(fd); fd = fs_open("myfile.txt"); char word[1000]; fs_read(fd,word,10000); fs_close(fd); printf("\"%s\" was read from myfile.txt\n",word); printf("size of myfile.txt - %d\n", fs_get_filesize("myfile.txt")); unmount_fs("test"); mount_fs("test"); fs_list_files(); printf("size of myfile.txt - %d\n", fs_get_filesize("myfile.txt")); printf("size of junk.txt - %d\n", fs_get_filesize("junk.txt")); fd = fs_open("myfile.txt"); fs_read(fd,word,10000); fs_close(fd); printf("\"%s\" was read from myfile.txt\n",word); fs_delete("myfile.txt"); fs_list_files(); unmount_fs("test"); return 0; }
bool default_make_fs() { return make_fs(default_io_ctx, default_mkfs_options); }