The text files are in this format :
No. Time Source Destination Protocol Info
1 0.000000 192.168.1.77 203.253.16.41 DNS Standard query A ksn1.kaspersky-labs.com
Frame 1: 83 bytes on wire (664 bits), 83 bytes captured (664 bits)
Ethernet II, Src: Giga-Byt_58:d7:ce (00:1f...
I need to know the identity of the current thread to keep track of which threads are making certain requests to a shared data structure.
...
I think this has happened to me before. This isA3.txt:
%INSERT
MARK 29
DAVID 21
JOHN 44
JOHN 51
LARRY 39
MARK 21
DAVID 18
JOHN 28
MARK 35
DONALD 41
PHIL 26
Even though I use sourcefile >> reader at the end of the loop, the program keeps outputting "reader: MARK", meaning the sourcefile >> reader; statement isn't working (i.e., it kee...
Say i have the following class :
class Abc {
int id;
public:
int getID() { return id; }
int setID(int id) { this->id = id; }
};
Is there any logical error in this ? I seem to be getting unexpected results (read : wrong values of id). I know this is not the way to write a getter .. but still there shudn't be any err...
I'm using C++ and need to access a USB camera's LED flash feature. I'm currently using DirectShow to interface with the camera in other ways (live preview stream, grabbing samples, etc.).
I found the CameraControl_Flash enumeration element on MSDN, but it appears to be implemented only for Windows Embedded CE 6.0 and Windows Mobile:
ht...
I want to write a program in c++ that prompts a user for a file name of an existing file that contains 10 records where the length of each record is 12 characters. next the program seeks to the beginning of the 6th record, reads the records in the file and append them to the end of an existing output file that contains 3 records.
Thank y...
I had only just noticed my programs using the string class were compiling without including the <string> header. It turns out that <iostream> includes <ios_base> which in turn includes <string>.
Is this bad practice and should I explicitly include <string>? Even if it's just a case of clarity?
Is it safe to assume this applies to more ...
I want to define an integer variable in C/C++ such that my integer can store 10 bytes of data or may be a x bytes of data as defined by me in the program.
for now..!
I tried the
int *ptr;
ptr = (int *)malloc(10);
code. Now if I'm finding the sizeof ptr, it is showing as 4 and not 10. Why?
...
Hi,
I have a bunch of classes and APIs written in C++ and exposed to Python with help of Boost.Python
I am currently investigating the possibilities of creating the following architecture.
In python:
from boostPythonModule import *
AddFunction( boostPythonObject.Method1, args )
AddFunction( boostPythonObject.Method2, args )
AddFuncti...
I'm using preprocessor macros to declare some repetitive variables, specifically:
QuitCallbackType quitCallback;
LossCallbackType lossCallback;
PauseCallbackType pauseCallback;
KeyCallbackType keyCallback;
MouseCallbackType mouseCallback;
I'd like to use a preprocessor macro to do it, a la
CREATE_CALLBACK_STORAGE(quit)
CREATE_CALLBAC...
I have this code that reads from marks.txt file.
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
int main () {
string name,result;
int number1;
ifstream myfile ("marks.txt");
if (myfile.is_open())
{
while ( !myfile.eof() )
{
getline (myfile,name,'\t');
getli...
I've just downloaded Visual Paradigm for UML and it looks quite ok. Does anyone have any experience with it? Or maybe someone has his own favourite IDE which is worth using and wouldn't mind sharing this knowledge? Do not want to use IDE which is written in JAVA or C# for patriotic reasons.
...
I have this in a text file:
John 20 30 40
mike 30 20 10
How do i read from the text file and separate them into variable name, var1, var2, var3.
This is my attempt, seems it doesnt work. Help please.
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
int main () {
string name,result;
...
So say I have the following very simple macro, along with a bit of code to output it:
#define SIMPLEHASH(STRING) STRING[1] + STRING[2] + STRING[3]
std::cout << SIMPLEHASH("Blah");
This outputs 309, and if you view the assembly you can see:
00131094 mov ecx,dword ptr [__imp_std::cout (132050h)]
0013109A push 135h
...
My experience tells me that given an object:
class Object
{
private:
static int array[];
public:
Object(int id);
};
int Object::array[] = { 2937, 892 };
Object::Object(int id)
{
// do something
}
The initialization of array will happen before the invocation of any method on Object or the invocation of any method on an...
I'm trying to figure out how I can iterate in reverse, and forward through this, or atleast call a method in reverse.
Here is how it works.
Widgets have a std::vector of Widget* which are that control's children. The child vector is z ordered which means that child[0] is behind child[1] (in render order). Each control has a pointer to ...
Possible Duplicate:
Learning to write a compiler
Hi Stack Overflow, now don't get me wrong, I don't intend to write a compiler for C++(though I intend to write it in C++) or Java or some other high level complex programming language. I just want to learn the basics of converting a basic instruction set into a Windows Executab...
Background: I'm using a delegation technique to abstract access to arbitrary object methods, but I'm having some issues where the linker is concerned. Consider the following class, ContextNode.
template <class ObjectType, class GetType, class SetType>
class ContextNode: public ContextNodeBase {
public:
ContextNode(ObjectType* tar...
Hello
Can somebody explain why second cout in func(char *p) doesn't work:
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
char *strhex(char *str);
char *func(char *p);
int main()
{
char *ptr;
char *p=strhex("d");
cout<<"main:"<<p<<endl;
...
Ok, I'm using C++ STL containers (currently vector<customType*>).
Now I need to remove elements from the container,
but using erase deconstructs the object, which is bad, since I'm taking it off one, and putting it onto a variable doing some processing then onto another one.
At the moment my code is quite nasty, and I'm just putting NUL...