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
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...
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...
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...
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...
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...
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...
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:...
How do I go about sending NULL bytes through a socket?
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...
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...
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
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;...
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"; }........
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...
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...
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 ){}...
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...
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...
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...
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...
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!!..
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);...
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...
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...
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...
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...
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...
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
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...
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...
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...
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...
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...
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...
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...
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...
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.
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!
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'...
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...
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...
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)...
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...
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...
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...
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...
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...
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!
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...