Hello All,

Please take a look at the following code. I have the following 2 questions.

Qt Code:
  1. FILE *filename1;
  2.  
  3. void MainWindow::update1(void)
  4. {
  5.  
  6. //something
  7. //something
  8.  
  9. filename1 = fopen(filename.toLocal8Bit(),"a");
  10.  
  11. //something
  12. }
  13.  
  14. void MainWindow::on_checkBox_clicked()
  15. {
  16.  
  17. if(ui->checkBox->isChecked())
  18. {
  19.  
  20. filename = QFileDialog::getSaveFileName(...)
  21. /*I'm creating a file when the checkBox is checked. When the checkBox is unchecked and checked back again, If the user selects existing file I want to append data
  22. instead of creating a new file. How do I do it?*/
  23.  
  24. if(!ui->checkBox->isChecked()){
  25.  
  26. //I want to append empty lines to the file a created above and close it. How can I do that?
To copy to clipboard, switch view to plain text mode 

Please help. Thanks in advance.