Is there a way without using arrays to write the following with a loop:
cout<<"This variable c1 ="c1
cout<<"This variable c2 ="c2
cout<<"This variable c3 ="c3
for(i=1,i<8,i++)
cout<<"This variable c%d =",i<<**????**<<
This is obviously not what I Need to be done but is the easiest example I could think of with the same problem...
So ...
Hi,
Is it okay to register WSACleanup through atExit function ? We have several applications that can terminate at different points in the code so we would like to avoid putting WSACleanup everywhere throughought the code. Curently we call WSAStartup / WSACleanup through DllMain since we have a dll that is used by all these applications...
How can i write code for send SMS with delivery message in Windows Mobile? please guide me with C# or C++ code.
I want to use SmsSendMessage API in this code because this API have more features.
...
Hello,
I am curious to know how to implement inline expansion.
I am writing my own compiler just for fun and education.
I learn a lot by example so if someone can provide me an algorithm that does inlining that can help.
I prefer in C++ but the language doesn't matter.
The target language that I'm trying to write inlining for is javascri...
While playing with implementing a virtual assignment operator I have ended with a funny behavior. It is not a compiler glitch, since g++ 4.1, 4.3 and VS 2005 share the same behavior.
Basically, the virtual operator= behaves differently than any other virtual function with respect to the code that is actually being executed.
struct Base...
I'm trying to make a modem call in one end, and in the other end the program answers the call. It doesn't seem to detect the carrier. Am I doing anything wrong? Am I missing something?
int main(int argc, char** argv)
{
ParseArgs(argc,argv);
SerialPort* port = SerialPort::New();
if(!port)
Error(ErrorNoMemory,"Can't create port");
i...
What is the difference between C++ and Visual C++? I know that c++ has the portability and all so if you know c++ how is it related to visual c++? Is visual c++ mostly for online apps? Would visual basic be better for desktop applications?
...
I need to make sure none of the lines in my code exceeds a a certain length.
Normally I separate lines where there's a comma or another suitable break.
How can I separate this line into 2?
cout<<"Error:This is a really long error message that exceeds the maximum permitted length.\n";
If I just press enter somewhere in the middle it ...
I have a BOOST_FOREACH loop to iterate over a list. Unfortunately, I also need to cache an iterator to a particular item.
typedef List::iterator savedIterator;
BOOST_FOREACH(Item &item, list)
{
// stuff...
if (condition)
savedIterator = &item; // this won't work
// do more stuff...
}
Obviously I can do this using a list.b...
Here is some tricky problem.
I am trying to watch a shared folder which is on Linux machine.
I am running the program on windows XP which is developed in Visual Studio 2005, VC++
and using FileSystemWatcher class.
But it's not raising events for that shared folder at all.
Please suggest a solution.
...
Hi,
I have a bitmap of large dimension (2000 x 2000) i need to shrink that bitmap to a small dimension (150 x 150). i have written a code for it, but its not working. Can anybody help in finding the problem? The problem is the destination bitmap is just blank. I am selecting wrong DC's? I have made sure that both the source and destinat...
I am looking for Blogs that discuss low level programming like assembler, how a .dll loads, how to process links to a .dll, and how a loader maps DLLs into a Process Address Space, among other topics.
Links are appreciated.
...
In the following code, gcc does not instantiate the NSP::Admin and NSP::Server objects.
It just skips them.
int main(int argc, char **argv)
{
// Here we boostrap google logging
// we also install the signal handler
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
// now we parse the arguments with gfl...
I have the following class
class CItem
{
public:
CItem(CRegistry &Registry) _Registry(Registry) {Registry.Register();}
~CItem() {_Registry.Unregister()};
private:
CRegistry &_Registry;
}
After a while it turns out that not all CItem objects need to be registered so I need a version of CItem which does not requires Registry i...
I've been trying to achieve that for the better part of the day, I'd honestly apreciate any help. Both of my apps, the client and the server started throwing "vector subscript out of range" exceptions.
How does one do this thing properly ?
Still trying to figure this out, anyone?
As far as I undestand I'm supposed to create a
boost...
class Thread
{
public:
Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg)
{
_handle = CreateThread (
0, // Security attributes
0, // Stack size
pFun,
pArg,
CREATE_SUSPENDED,
&_tid);
}
~Thread () { CloseHandle (_handle); }
void Resume () { ResumeThread (_hand...
I have this following code:
template <class T>
bool loadCSV (const QString &filename, map<T,int> &mapping){
QFile boxfile;
boxfile.setFileName(filename);
QString line;
QStringList list;
if (!boxfile.open(QIODevice::ReadOnly)){
cout << "Could not open box data file." << endl;
return false;
}
QTextS...
I want to create a function that can take different types of iterators which store the same type of object:
The first is a std::map containing shared_ptr<Foo> (typedef-ed as FooMap) and the other is a std::list which also contains shared_ptr<Foo> (FooList).
I really like the solution MSalters suggested for a similar question and tried t...
I'm currently refactoring some code to make it more testable.
Specifically, I am extracting the interface of several classes to allow easy creation of test doubles.
I'd like to keep the public interface the same to this code, naming the interface after the original class.
However this leaves me with the problem of what to call the ori...
I am trying to parse text off of a PDF page into sentences but it is much more difficult than I had anticipated. There are a whole lot of special cases to consider such as initials, decimals, quotations, etc which contain periods but do not necessarily end the sentence.
I was curious if anyone here was familiar with an NLP library for ...