Using QFile
-
Hi all,
I have the following bit of code written in C:
FILE *f=fopen(config_file_name, "rb"); if(!f) { perror(config_file_name); printf("Could not open file '%s'\n", config_file_name); return; } size_t len=0; while(!feof(f)) { len+=fread(config+len, 1, MAX_CONFIG_FILE_LENGTH-len, f); // to read bytes from file } fclose(f); if(len) { send_long_register((nv_config?STIM_LONG_REG_NV_STIM_CONFIG_FILE:STIM_LONG_REG_STIM_CONFIG_FILE), len, (uint8_t*)config); // send the content to another function } else { printf("Could not read any bytes from file.\n"); }
How can I do the same operations using QFile??
Thank you :)
-
Hi all,
I have the following bit of code written in C:
FILE *f=fopen(config_file_name, "rb"); if(!f) { perror(config_file_name); printf("Could not open file '%s'\n", config_file_name); return; } size_t len=0; while(!feof(f)) { len+=fread(config+len, 1, MAX_CONFIG_FILE_LENGTH-len, f); // to read bytes from file } fclose(f); if(len) { send_long_register((nv_config?STIM_LONG_REG_NV_STIM_CONFIG_FILE:STIM_LONG_REG_STIM_CONFIG_FILE), len, (uint8_t*)config); // send the content to another function } else { printf("Could not read any bytes from file.\n"); }
How can I do the same operations using QFile??
Thank you :)