Reading raw data from USB port

295 byte By vbadira at 2007-11-20 10:59:55
Anyone please help.<br/>I am trying to read raw data from the USB port. For example, I want to get the HEX for the USB mouse. This will help me write a program to get data for more complicated devices or data from biometric sensors attached to the USB.<br/>Kindest regards,<br/>VB

Questions about creating a 3D array class

1066 byte By leileicats at 2007-11-20 10:59:58
I am doing one project in the book "Data Structures and Algorithms with Object-Oriented Design Patterns in C++". The project is designing a 3D array class based on previous 2D array class.Code as follows:template<class T>class Array2D{public: Array2D(int w, int h):width(w), height(h), array...

Query related to Single LinkedList?

611 byte By dp_76 at 2007-11-20 11:00:08
Hi AllI have a single llist, let say with 50 links.Some kind of corruption have occured in my llist such that the 35th link instead of pointing to the 36th link now points to the 7th link.Now if i have to trace the entire llist for some value which is say present at the 40th link.Since the llist is...

Reading a file - weird values

6335 byte By Mybowlcut at 2007-11-20 11:00:14
Hey.Trying to read text from a .txt file, but I'm getting WACKO results:This is an image of the debugger watch. ( http://i50.photobucket.com/albums/f344/mybowlcut/untitled-12.png)The file contains this:T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_000 T_00...

Recording in chunks

579 byte By ColdFire at 2007-11-20 11:00:37
I am using third party API's to record voice. Currently the voice data is stored in a single WAV file. Recording time is variable (most of the time very long) which might cause the single wav file to exceed file size limit. Further post-processing on that large file also inefficient. As an alte...

Base Class Undefined Problem

747 byte By utkseth at 2007-11-20 11:00:44
HiI have 2 header files. grabLine.h and lineClass.h. They go something like thisgrabLine.hclass grabLine: public GlApp{ public: private:};lineClass.hclass lineClass: public grabLine{ public: private:};But when i compile it i get the errorerror C2504: 'grabLine' : base...

std::string: has my compiler gone nuts?

2552 byte By Andruu75 at 2007-11-20 11:00:52
To the Pros out there:Hy, im searching for a bug since 2 days, and i asked a lot of pros in my company, but nobody could help me.Heres the situation:Visual Studio Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600)I had a project with a strange bug, so i could melt down the problem...

Wide char macro

888 byte By rpmivh at 2007-11-20 11:00:54
Anyone know of a good macro for handling unicode/multibyte strings in template classes. I've come up with this one #define _TT( c, s ) ( 1 == sizeof( c ) ? ( ( c* )s ) : ( ( c* )L##s ) )It works for most cases except array initializationtemplate< typename T > class TSomeClass{public:...

\x00

54 byte By King Zarathu at 2007-11-20 11:01:03
How do I go about sending NULL bytes through a socket?

Accessing malloced buffer takes more time

2135 byte By kgvinod at 2007-11-20 11:01:04
I observed that writing to a malloc'ed buffer takes more time, as compared to writing to an array that is created using 'new'. This observation was on an embedded box, but I was able to observe the same on a desktop build, although the difference in time was less on desktop. Please s...

error LNK2005: class already defined

3208 byte By utkseth at 2007-11-20 11:01:16
HII am getting a weird linker error. My code is given belowfilename: grabLine.cpp#include <gmtl/Point.h>#include <gmtl/Matrix.h>#include <gmtl/Containment.h>#include <gmtl/Generate.h>#include <gmtl/Output.h>#include <iostream>#include "grabLine.h"//function defini...

Read wave file audio data

234 byte By Invader Zim at 2007-11-20 11:01:19
How do I read the wave file audio data into a buffer?<br/>I want to play the audio data using alsa/asoundlib<br/> snd_pcm_writei(handle , buffer , 2 * period_size); <br/> <br/>where "buffer" is my buffer containing the sound data

Allocating three structures, using "new" keyword

1422 byte By The SharK at 2007-11-20 11:01:20
Hi, I want to make three structures by using the "new" keywordto dynamically allocate memory, but it seems I only get ONEstructure out of this code:#include <iostream> using namespace std; struct CandyBar{ char BrandName[10]; float Weight; int Calories;};int main(){ CandyBar * pCB;...

using the "for" loop

519 byte By mus2002stang at 2007-11-20 11:01:27
how can i use the for loop with words instead of number for example:........ cout << "Choose C)hecking S)avings B)alance:"; cin >> option; if (option == "c") { cout << "this is checking"; } else if (option == "s") { cout << "this is savings"; }........

Linked lists or arrays for url-list in a distributed webcrawler?

3046 byte By Hannson at 2007-11-20 11:01:28
Hi.I'm new here! I'm a kind of newbie when it comes to c++ programming although I've got the logic - I'm just getting hold on the syntax and such. I've got about a 3 year experience in PHP programming/scripting and web design but I've been learning general programming a...

Getting Obscure Numbers For End Result! HELP!

4301 byte By beret9987 at 2007-11-20 11:01:30
Hi, I have this program that I wrote to calculate electricity rates for class. The only problem was when I ran it I got a weird number. I started changing some things but I still can't get it to work. If anyone could just take a look at it and tell me how to correct it that would be great. Than...

What does the reference to pointer mean?

306 byte By whutes at 2007-11-20 11:01:42
In the following declaration of C++ function, two references to pointers (int *& tags and char **&ctags) are used. Can anyone tell me why we can't just use pointers like int * tags? What's the difference?int cdevData::readTagTable ( int * &tags, char ** &ctags, int &ntags ){}...

factory method with shared pointers

557 byte By dave2k at 2007-11-20 11:01:47
i would like to have a member function which acts as a factory, giving out new instances of objects wrapped in a boost::shared_ptr. This is easy enough, but my problem is that sometimes i do not want to return a new object, i wish to return this object.The trouble is when i try to wrap this in a sha...

what is being done after ":" sign?

399 byte By asilter at 2007-11-20 11:01:52
i'm trying to read and understand a .cc (c++)file, i want to know what does ok_flag(false),time_range(false),prefix() do after ":" ?I did know that ":" was being used for class inheritance but what is ":" for in the bleow code?ClassA::ClassA(const char *db) : ok_flag(false),time_range(false),pr...

Variatic functions and Structures

1289 byte By Emull at 2007-11-20 11:02:05
I am attempting to pass a variable amount of arrays consisting of variable amount of structures to a class constructor. I am confused on two points. 1. Can I somehow determine the size of the array (s) without having them passed as a parameter?2. How do I reference the array of structs to assign...

Base class undefined

859 byte By Mybowlcut at 2007-11-20 11:02:08
Hey. I've got a problem with including header files/classes that I still haven't been able to solve. It's a typical situation, and I've searched for threads but I cannot get anything out of them to solve it.(This is not my actual code obviously)/* A_Class.h */#ifndef A_CLASS_H#de...

coping different file..

137 byte By Rooting at 2007-11-20 11:02:11
hi friends.<br/>i wold copyng different file *html in a directory..<br/>in c++, how can i do??..whithous using "system()".<br/>thanks!!..

curious question about a loop

2273 byte By muran at 2007-11-20 11:02:14
in my code#include <cstdlib>#include <iostream>#include <stack>using namespace std;void unionMerge(stack<int>& S, stack<int>& T);int main(){ stack <int> Q; stack <int> P; Q.push(5); Q.push(7); Q.push(8); Q.push(9); P.push(1);...

Windows / Linux download website HTML code?

1432 byte By ryodoan at 2007-11-20 11:02:19
To start this post off I suppose some background is in order.I have used Visual Basic .net and Visual Studio .net for several years now and written several programs that I use regularly. Just recently I have started to become more interested in Linux operating systems and also through my work I hav...

iterate from somewhere other than beginning or end of list?

1006 byte By dermite at 2007-11-20 11:02:27
Folks,I'd really appreciate your help with the following. I am relatively inexperienced in C++, so please excuse me if this problem has an obvious solution that I have overlooked.As I understand it, the functionality of a list in C++ is implemented, under the hood, using a linked list. With a l...

merging and sorting n1 and n2 with int .size() vector

765 byte By muran at 2007-11-20 11:02:29
hey guys, i want to know how to merge and sort, for example..The key element of the merge sort algorithm is the merging routine.Write code that will implement the following function:void merge(vector <int> data, int n1, int n2);// Precondition: The first n1 elements of data are sorted, and the...

How to read from file 1 to X(unknown) files

701 byte By lone2082 at 2007-11-20 11:02:38
Greetings to all experts here. I have been pondering this issue for 2 days and wonder any 1 can offer me a simple solution to it.For example,There are X numbers of files. First file starts at 000001.txt and the last file may end at 001001.txt . But the problem is I do not know the number of fil...

boost::dynamic_pointer_cast doesnt work as expected

797 byte By BRN at 2007-11-20 11:02:49
Hi,see these lines using shared_ptr of Boost library:boost::shared_ptr<Executor> executor(&(createExecutor(subclass,name)));if(!executor) { throw LoadingClassException("createExecutor functionof\""+subclass+"\" return null.");}//executor points to an object of class ExecDebugger th...

Insertions, Deletions, Weaving, and Reversals

265 byte By TheMiz19 at 2007-11-20 11:02:53
Sorry kinda of a noob question, but i was wondering how you would Insert, Delete, Weave, and Reverse characters of an array from an input file?<br/>ex: Hello Delete 2 - 3 to equal heo<br/>how would you do that for insert, delete, weave, and reverse

vector iterator

1973 byte By hka26 at 2007-11-20 11:03:00
HiI have a question regarding vector iteratorI have a class which looks like thisclass CardItem{ public: CardItem(){ Card newcard(1, JOCKER); set.push_back(newcard); Card newcard2(2, DIAMOND); set.push_back(newcard2); }; virtual ~Ca...

"Cheat Engine"

1516 byte By RobotGymnast at 2007-11-20 11:03:03
Hi.. I'm new here (I thought I'd signed up here before, but I guess not), and I signed up because I was wondering a lot about the main programming of something called Cheat Engine ( http://www.cheatengine.org/).. to understand what I talk about from here on, you might meed to download this...

Get pointer to a class method

708 byte By felipenfranco at 2007-11-20 11:03:08
How can i get a pointer to a class method?Like:class MyClass{MyClass(){};int sum(int a,int b){return a+b;}void call_op("here is a pointer to the sum method"){int x;x=pointer(1,2);cout << x; //should print 3}}//now here is the dealint main(){MyClass test;sometype pointer;pointer = "pointer to t...

Execution time of a cycle

456 byte By weby at 2007-11-20 11:03:09
Here's the code:char a[10000000];int k;main(){ code1: for (int i=0; i<100000000; i++){ k=rand()<<0; a[k]=0; }code2: for (i=0; i<100000000; i++){ k=rand()<<5; a[k]=0; }}Can anyone tell me why the first cycle "code1" runs in 0.66s while the second in 7.3s?The cycles wi...

converting binary to dec

1539 byte By brynpttrsn at 2007-11-20 11:03:12
I am trying to convert binary numbers to decimals WITHOUT ARRAYS just to be difficult.this is my code:#include<iostream.h>#include<math.h>void convert(float, int);int main(){ int place, num, ans, dec; float bin; place = 0; dec = 0; cout << "Input the binary number."; cin >> b...

how can i make a comparison or choice inside a if, or else if option

2474 byte By mus2002stang at 2007-11-20 11:03:13
I am trying to write a program (im new to c++) that ask the user three options(using a if else if) that is working fine. Now im trying to ask the user and option within one of these three choices.example: do u want a, b, or c?say they choose anow ask do you want x or y. (within choice a)here is what...

Converting Windows coding to Linux

6124 byte By jmajeremy at 2007-11-20 11:03:14
Hi,I recently switched to linux, and decided to try and compile a little c++ script. When I compiled this on Windows, it worked fine, but now I'm getting a long list of errors...I've posted the entire code below, and I'm hoping someone will have the time to tell me what needs to be ch...

fstream problem

678 byte By BageDevimo at 2007-11-20 11:03:21
Hey,I have the following code #include <iostream>#include <fstream>using namespace std;int main(int argc, char *argv[]) { ofstream logWrite("CompileLog.log"); for(int i=1; i<argc ;i++ ) { logWrite << argv[i] << endl; cout << argv[i] << endl; system("pause"); l...

split up array

269 byte By whatnow at 2007-11-20 11:03:22
how do i partition array 1000002 elements into elements/n +elements%n<br/>what kind of array <br/>static int[n];<br/>static int* arr=new int[n]<br/>i am trying to implement worst linear select algorithm but can't seem to go above 150 elements.

Help with a function on vowels returns 0?

261 byte By redman43 at 2007-11-20 11:03:25
Thanks for the help I found the error! well i never really found it but I retyped everytihng from scratch and got it working!! I guess I made that error that you were talking about greggle! I see it now I didnt put that in the second time around! lack of sleep!

gcc and templates

819 byte By c94wjpn at 2007-11-20 11:03:48
Have a look at this code folks:template<typename T, int NN>class CBlock{public: CBlock() {}; ~CBlock() {}; T* m_pBase;};template <typename T, int NN>class CMemBlock : public CBlock<T, NN>{public: CMemBlock() { m_pBase = new T[NN*NN]; }; ~CMemBlock() { delete m_pBase; };};I'...

Problem with destructor code

5163 byte By kirankn at 2007-11-20 11:03:51
I have a matrix class with overloaded mutliplication operator(*) and assignment operator(=).I am declaring a variable( for result) inside a class function. I am using the 'new' operator to assign memory in constructor and 'delete'operator in destructor. But I am getting a runtime...

Performance: Switch vs If Chain

815 byte By MrDoomMaster at 2007-11-20 11:04:13
Hi,I have an inquiry regarding the performance of a switch vs if chain. For example:EXAMPLE 1int SomeNumber;switch( SomeNumber ){ case 0: break; case 1: break; case 2: break;}vsEXAMPLE 2int SomeNumber;if( SomeNumber == 0 ) {}else if( SomeNumber == 1 ) {}else if( SomeNumber == 2 ) {}Now, I k...

Undefined behaviour??

1343 byte By PredicateNormative at 2007-11-20 11:04:21
Is the following going to produce undefined behaviour, or is it acceptable? I am basically trying to get a member object to write log messages only if the class from which it is instanced has its logState set to true.class SomeClass{public: SomeClass() :_logState(false) ,_memberObject(this)...

Operating Systems Assignment

915 byte By dattdogg at 2007-11-20 11:04:23
This is probably something really dumb that I'm overlooking. My assignment was to create a simple unix shell that would execute console commands in a child process. The shell must also have a history function that invokes when the user presses <ctrl><c> and the shell exits when the...

Segmentation fault

4220 byte By cyberjoac at 2007-11-20 11:04:39
Hello everybody, I know it's not easy to debug but maybe you could see some crazy errors that would be really easy to see, so I post it anyway...Please help, I got to post this tonight and I can't manage to solve this bugYou can ask any questions...#include <iostream>#include "MyHash...

new newnewbie help

710 byte By mikethesniper at 2007-11-20 11:04:47
hi everyone, im a new new newbie to c++ and am merely taking my first few steps i am using Dev-c++ to compile my first simple code and have hit two errors the first when i load 'Dev' warns me that " there doesn't seem to be GNU make file in PATH or in Dev-C++ Bin path please make sure...

Undefined pointer issue

746 byte By Iteria at 2007-11-20 11:04:52
I can't figure out why I get a runtime error when I run my function. The function fails without running a single line of my function. The error reads: Run-Time Check Failure #3 - The variable 'parsed' is being used without being defined.In my main my code sets up like this:char* str9...

c++ prog.

2352 byte By TR86 at 2007-11-20 11:04:57
hey everyone, i have spent alot of time trying to figure this out but im stuck. anything i change from here on gives me 29+ errors. what the program is supposed to do is ask the user to put in a playing card abbreviation (example, KH = king of hearts) KH and the program puts out KING OF HEARTS. i kn...

Copying the program to folder

188 byte By wild life at 2007-11-20 11:05:00
Hello i have this problem. I am making c++ program and i need to make the program create a copy of itself with name copy.exe to folder c:\backup. So how is this done. Thank you in advance!

detecting file extensions

909 byte By meeatingrice at 2007-11-20 11:05:05
Hi,I'm a newbie and trying to write a c++ program to detect file extensions. What I did was stored from an argument into string 'filename' and got the last 4 characters and stored that into 'extension'. Now I want to see if it's a PDF file by looking at 'extensio...