Outputting to a file

Started by
18 comments, last by Luckless 8 years, 2 months ago

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]

Mobile Developer at PawPrint Games ltd.

(Not "mobile" as in I move around a lot, but as in phones, mobile phone developer)

(Although I am mobile. no, not as in a babies mobile, I move from place to place)

(Not "place" as in fish, but location.)

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"

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty

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 )

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

"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.

"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?

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

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

My favorite was when running a tiny ORPG game with a few other devs, with a userbase of only 20 users.

Norton Antivirus decided to mock our efforts:

e868e15b70.png

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.

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.

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.

This topic is closed to new replies.

Advertisement