•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 375,174 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,236 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 1425 | Replies: 2
![]() |
•
•
Join Date: Jun 2005
Posts: 69
Reputation:
Rep Power: 4
Solved Threads: 0
I'm coding in VC++.NET 2003. I have a class that needs a log file to log info and errors for debugging. The problem I have is that FileStream and StreamWriter can not be global. I get compiler error C3145 : cannot declare a global or static managed type object or a __gc pointer. A workaround was to open, write, and then close the log file in every function/event. During testing, I discovered that this won't work since other functions/events may be executed before the previous function/event has closed the file. Any suggestions?
FileStream* fs = new FileStream(S"c:\\Variables.txt", FileMode::Append, FileAccess::Write, FileShare::Write); fs->Close(); StreamWriter* sw = new StreamWriter(S"c:\\Variables.txt", true, Encoding::ASCII); String* NextLine=S"This is the appended line."; sw->Write(NextLine); sw->Close();
Last edited by Dave Sinkula : Apr 25th, 2006 at 9:50 am.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
Similar Threads
- Virus/Spyware on computer, Hijack This log file (Viruses, Spyware and other Nasties)
- HJT log file (Viruses, Spyware and other Nasties)
- HJT Log File For Laptop: Need Help! (Viruses, Spyware and other Nasties)
- HijackThis Log file help for my other Computer (Viruses, Spyware and other Nasties)
- Bridge.dll error please help me here is my hijackthis log file! (Viruses, Spyware and other Nasties)
- ANOTHER hijackthis log file..help! (res://mshp.dll, lookfor.cc) (Viruses, Spyware and other Nasties)
- HijackThis log file (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: 2 strings on the same line...
- Next Thread: C++ Program Contest



Linear Mode