Jump to content
  • Advertisement
Sign in to follow this  
dsm1891

Outputting to a file

This topic is 1040 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, Here I am reading in this Json file and manipulating the values, and I get to a point where I need to see the output... (admittedly I should have done this earlier)

 

I try (C++)

  std::fstream fs;
  fs.open ("test.txt", std::fstream::in | std::fstream::out | std::fstream::app);

  fs << " more lorem ipsum";

  fs.close();

hmm, strange, not working.

 

I try ofstream, just to make sure.

ofstream myfile;
  myfile.open ("example.txt");
  myfile << "Writing this to a file.\n";
  myfile.close();

uh... still no file.

char filename[]="example.txt";
FileStream *fs = new FileStream(filename, FileMode::Create, FileAccess::Write);
fstream *fs =new fstream(filename,ios::out|ios::binary);
fs->write("ghgh", 4);
fs->close();

ok... this is annoying me now!

 

 

I try absolute paths, on all the files above.

nadda.

 

 

Hmm maybe the folder is funky and doesn't allow writing to files, so I try `c:\public\Desktop`

 

Still nothing.

 

Any guesses of what was wrong?

 

Answer:

[spoiler]my antivirus was blocking me from creating a file sad.png [/spoiler]

Share this post


Link to post
Share on other sites
Advertisement

Reminds me of the time my antivirus decided to delete all DLL files in my python site-packages while I was debugging. "Unable to call function: Function was deleted from your computer"

Share this post


Link to post
Share on other sites

i guess its a case of "catch 11" (younger sibling to catch 22) here. Without anti-virus dangerous things happen to your system, with anti-virus stupid things happen to your system. I guess you will prefer stupid things to dangerous things

 

I'm kind of a novice sometimes, complete noob wub.png  - Recently, actually a day ago, I saw a strange program "COM surrogate" running on my system. I googled it and discovered its a dangerous virus. I had listened sometimes ago to the good guys of this forum that anti-virus are more of a pain than anything (and seriously slowing you system down), ... and it is not needed as long as windows defender is always on. So i removed my antivirus and always made sure windows defender is on

 

So despite this how did "COM surrogate" get on to my system?  I still don't know how to remove it yet ... despite my efforts

 

So i guess I got to get my Avast back,  yeah stupid things would happen but at least dangerous things would be prevented

 

(and BTW if anyone knows how i can get rid of "COM surrogate" please let me know .... smile.png )

Share this post


Link to post
Share on other sites

"COM surrogate" is dllhost.exe and part of your OS. For example, explorer.exe uses "COM surrogate" to generate thumbnails, that way if something goes wrong and crashes your explorer won't die.

Although I cannot deny that some viruses are able to use it.

Share this post


Link to post
Share on other sites

"COM surrogate" is dllhost.exe and part of your OS. For example, explorer.exe uses "COM surrogate" to generate thumbnails, that way if something goes wrong and crashes your explorer won't die.
Although I cannot deny that some viruses are able to use it.

 

Oops!

thanks for letting me know. Weird though that its so associated with a virus when you google it

Said i was a noob didn't i?

Share this post


Link to post
Share on other sites

Several years ago, I was using a Mac emulator to access an old drive to retrieve old programming archives. I had to buy a SCSI card and everything to get this to work. Avast! decided that the emulator files containing the drive contained a virus and deleted them all.angry.png Fortunately I still had the drive and could retrieve the files... again... but it was annoying. Since I had the emulator up and running, I ran Disinfectant, a 68000-based Mac antivirus program, on the physical drive. No viruses... dry.png

Share this post


Link to post
Share on other sites

I read more often than I remember that Avast randomly deletes stuff from your HDD. You might want to switch to something better.

Avira was not doing this when I used it, though you might want to check all options to be sure.

Share this post


Link to post
Share on other sites

I read more often than I remember that Avast randomly deletes stuff from your HDD.

 

Some versions of Norton does the same (using both blacklists and whitelists), but you can disable the whitelisting.

Share this post


Link to post
Share on other sites

They should ask what to do or at least move it into quarantine and give the option to restore it, especially as they depend on heuristics with a high failure rate.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!