Jump to content

ofstream not working inside SC_CTHREAD


Nithin

Recommended Posts

Hi,

I am not able to do file write operations inside SC_CTHREAD. Is that expected? Is that a known behavior with SC_CTHREAD? It doesn't give any error, but the file is empty. The same file write operations work in an SC_THREAD though.

Here is my SC_CTHREAD function.

void MOD::READ_FROM_FIFO() {
  sc_bv<6> S_val;
  ofstream f1;
  f1.open ("output.txt");
  while(true) {
    S_val = FIFO.read();
    S.write(S_val);
    f1 << "READ_FROM_DS_FIFO DBG1: S_val= " << S_val<< "\n";
    wait();
  }
  f1.close();
}

Any guidance is appreciated. Thanks in advance.

Regards,

Nithin


 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...