143 Posted Topics

Member Avatar for Dogtree

I've noticed two strange things with my sound card when it comes to using a microphone. Using multiple microphones, they work, but the result is very very quiet. Also, the plugs are are very loose when seated in the microphone socket. Without going into detailed troubleshooting, has anyone seen these …

0
62
Member Avatar for edelstahl

C++ only natively supports file access through iostreams. You create an object of the *fstream family of classes and open them using a file name and orientation. To open a file for reading you would probably do this: [code] #include <iostream> #include <fstream> #include <string> int main() { std::ifstream file("file"); …

Member Avatar for Dogtree
0
1K
Member Avatar for winbatch
Member Avatar for usausa

You have to be careful since .dsp and .dsw files are binary if I remember right. That limits you to a container of unsigned char and unformatted binary input: [code] std::vector<unsigned char> v; unsigned char c; std::ifstream s1("doit.dsp", std::ios::binary); while (s1.get(c)) v.push_back(c); [/code] Anything else risks undefined behavior or unwanted …

Member Avatar for Dogtree
0
134
Member Avatar for koolhead17

You know, these statements are easier to believe when you can write coherent English and provide objective arguments. You haven't done either, so you can only expect to be treated as a troll.

Member Avatar for vegaseat
0
156
Member Avatar for davejigsaw

When you don't understand an algorithm, the best way to figure it out is to run it through a debugger step by step, or write down the execution on paper. Of course, if the algorithm is wrong, or the right way to call the function is misunderstood, naturally it will …

Member Avatar for Ghost
0
131
Member Avatar for Prahaai

NORTH, NORTHEAST, SOUTH, and SOUTHEAST are all integral values, probably members of an enum, possibly #define's. The switch is keyed on the getSrcDir() member of path, which returns one of those integral values. It's basically an abstracted version of this: [code] int dir; // ... switch (dir) { case 0: …

Member Avatar for Dogtree
0
177
Member Avatar for usausa

Can you get a string from one file? If so then can you get a string from more than one file in the same directory? Do you have to search for the files according to some pattern, or do you have a list of filenames? I see this question a …

Member Avatar for vegaseat
0
460
Member Avatar for t3bruce
Re: help

Accelerated C++ by Andrew Koenig and Barbara Moo. The Design and Evolution of C++ and The C++ Programming Language by Bjarne Stroustrup are also books you'll want to have on your shelf if you plan to really learn C++ and not just get through a few classes. :) Note that …

Member Avatar for t3bruce
0
162
Member Avatar for silkfire

Your biggest problem is trying to use stream.read() and stream.write() with a non-POD type. Because the string class is not a trivial class, and your PersonInfo struct has at least one of them, read and write are only guaranteed to cause undefined behavior. You would be better off defining a …

Member Avatar for silkfire
0
188
Member Avatar for Prahaai

[code] int NoLinesIgnored, NoCharsIgnored, NoCharsWanted; std::string s; // ... while (--NoLinesIgnored >= 0) { // Read and discard a line file.ignore(std::numeric_limits<streamsize>::max(), '\n'); } // Read and discard N characters file.ignore(NoCharsIgnored); // Read and save N characters file >> std::setw(NoCharsWanted) >> s; [/code] How you do this will vary depending on …

Member Avatar for Dave Sinkula
0
220
Member Avatar for jean

Think recursively. Operands return the value, binary operators perform themselves on the left and right value: [code] if (is_operand()) return value; T a = recurse(left); T b = recurse(right); switch (operator()) { case '+': return a + b; case '-': return a - b; case '*': return a * b; …

Member Avatar for Dogtree
0
122
Member Avatar for dejaz

How does that function not work? There are a few iffy parts, like not checking fopen for success and not considering that fread can return a non-zero failure code, but there are no obvious errors that I can see this early in the morning. ;)

Member Avatar for dejaz
0
250
Member Avatar for Tetsu

When you swap the name array, you'll have to swap all of the other arrays along with it, since each array is a unique object. A good alternative is to stuff everything in an structure and then sort an array of structs: [code] struct record { string name; // ... …

Member Avatar for Tetsu
0
472
Member Avatar for MitchellH

You have to do everything that MFC does for you manually. That's a pretty broad topic because "dialog-based application" covers a LOT of stuff. You should consider picking up Charles Petzold's Programming Windows.

Member Avatar for Dogtree
0
148
Member Avatar for cspikes

Fill in the blanks: [code] class Entry { char _name[41]; // +1 for '\0' char _number[7]; // Not including format characters public: Entry(const char *name, const char *number); void reset(const char *name, const char *number); const char *name() const { /* ... */ } const char *number() const { /* …

Member Avatar for Dogtree
0
139
Member Avatar for t3bruce

As much as I want to help you, it looks like you want someone else to do your work for you. The code you've provided doesn't even come close to an attempt to solve the problem. It's asking you to write a Dice class that supports rolling the dice and …

Member Avatar for Dave Sinkula
0
180
Member Avatar for t3bruce

What have you tried so far, and why is everyone posting C++ questions in the Community Introductions forum? There's a separate C++ forum for such problems.

Member Avatar for Dogtree
0
182
Member Avatar for hzuniga4

It sounds like the stream isn't getting flushed. That's not correct behavior because calling exit() will flush all output streams with unwritten data. Just for grins, try changing cout to cerr and see what happens. cerr has the unitbuf flag set by default, so it should flush the stream after …

Member Avatar for Catweazle
0
127
Member Avatar for Funktar

>>strcat(msgbuf, (char*)pid); If you have to cast to char * then chances are good you're doing something wrong. ;) What type is pid? I'm guessing it's an int, and that would be a problem because typecasting doesn't make an integer into a string.

Member Avatar for Dogtree
0
175
Member Avatar for silicon

Your comments are pretty useless for understanding the algorithm. Sure, you may understand the mechanics of each line taken out of context, but do you understand the purpose of each line when taken as a whole for the algorithm? Comments are better for documenting the reasons for doing something, not …

Member Avatar for Dogtree
0
130
Member Avatar for sinrtb

Was this what you were trying to do? [code] Activity **p = new Activity*[51]; for ( int i = 1; i <= n; ++i ) { // Read the activity records. pert >> (*(p+i))->i >> (*(p+i))->j >> (*(p+i))->pt >> (*(p+i))->prt >> (*(p+i))->ot; pert.getline((*(p+i))->desc,21); } [/code]

Member Avatar for Dogtree
0
456
Member Avatar for JoBe

If you want to make the class look something like a standard C++ container then Narue's code is about as simple as it gets. You define a data structure that holds items and then define an iterator that controls safe traversal of those items. A simpler, but less safe, linked …

Member Avatar for Dogtree
0
228
Member Avatar for Dogtree

Howdy, I'm an IT professional for a seafood distribution corporation. My hobby/obssession is programming with C and C++, so I'll probably hang around there most of the time. The IRC channel is also a cool place, so expect to see me there too. :)

Member Avatar for meksikatsi
0
170
Member Avatar for bpshivade

I haven't actually written code for fingerprint matching, but I've studied the methods and algorithms and it's pretty complicated. There are a bunch of ways to do it, and I doubt that even if anyone has code not under a non-disclosure agreement, they won't just give it to you. If …

Member Avatar for Dogtree
-1
232
Member Avatar for M.Rodz

You've pretty much checked off everything on the "don't do" list of basic C. Maybe you should start using the standard C++ classes instead of fumbling around with the low level arrays and pointers of the C subset of C++. It's easier to get right if you don't have years …

Member Avatar for Dogtree
0
209
Member Avatar for tyczj

If you defined your operator<< correctly, which seems to be the case, then you don't need to do anything special. That's the nice thing about extending iostreams, you can use them just like you would the standard library stuff: [code] cout << xVal << ' ' << yVal << '\n'; …

Member Avatar for Dogtree
0
231
Member Avatar for SquirrelProdigy

One good reason would be to hide the implementation. If any changes need to be made to the implementation then it makes sense to separate it into a single file so that any code that uses the header doesn't need to be recompiled. If you place declarations in a header …

Member Avatar for Dogtree
0
165
Member Avatar for Scuuba

You never initialize grade to anything. In calculateGrade you assign to grade, but don't do anything else with it, so when the function terminates, all of the work is lost. Then in printResult, you redefine grade, but don't give it a value, so you'll get garbage.

Member Avatar for Scuuba
0
124
Member Avatar for madt

This might give you a start for how to define them: [code] #include <iostream> #include <utility> class Integer { int _val; public: Integer(): _val(0) {} Integer(int val): _val(val) {} int get() const { return _val; } Integer operator+=(const Integer& rhs) { return _val += rhs._val; } Integer operator-=(const Integer& rhs) …

Member Avatar for Dogtree
0
169
Member Avatar for Auron

You're basically just describing the "area of rooms" concept with different terminology. Both can be easily written using multidimensional arrays, or sparse matrices. In the file you could have the x/y/x coordinates that relate to the array indexes followed by location information: [code] 0 0 0 Information about the location …

Member Avatar for Libertate
0
292
Member Avatar for nathanj99

Your best start is by reading the documentation to your compiler. There's no native support for printers in C++, and your compiler probably offers several ways to do it.

Member Avatar for vegaseat
0
180
Member Avatar for maro009

Can you shrink down your code to something small enough to post? I don't think anyone wants to download your attachment, unzip it, create a collection of source files to match their environment's needs, compile and run your program, then debug it to find the problem. If your program is …

Member Avatar for Dogtree
0
64
Member Avatar for tat2dlady

>>if ( !isdigit( a ) || !isdigit( b ) ) isdigit takes a single int as its argument, and the int must be in the range of an unsigned char. Both a and b are being passed as pointers to char. Now, since the is* functions from ctype.h are typically …

Member Avatar for Dogtree
0
1K
Member Avatar for lizzie

First, make sure that the wireless adapter is working properly and the network connection is enabled and set for DHCP rather than a static IP address. Search for nearby connections to make sure that you can see the wireless access point of the place you're trying to connect to. If …

Member Avatar for Dogtree
0
106
Member Avatar for <<J_M_K>>

>>So much for Daniweb. Does anyone have at least a better forum I can go to? What do you mean "So much for Daniweb"? Do you have any idea how large and complex an application like this would be? I can guarantee that you won't find a forum out there …

Member Avatar for Dogtree
0
219
Member Avatar for Mr.

I would think that if there's no server, that's a fatal error for the client. Since this is for testing purposes, why bother with an elaborate workaround when you can simply make sure that you run the server first?

Member Avatar for Mr.
0
211
Member Avatar for pranavjec

[QUOTE=dorianoria]Dear guy, I'm looking for information about how to display segy data. However, for your interest, you must know that with perl you could get that information easier. If you are interested, I can send you an extract of the algorithm. Regards, Dorian Oria[/QUOTE] Um, chances are good that if …

Member Avatar for Dogtree
0
202
Member Avatar for kramer147

If I recall correctly, mingw doesn't support curses "out of the box". You can download and install PDcurses from [url]http://pdcurses.sourceforge.net/[/url]. Or if you still want to use getch outside of the curses library, this might work for you: [code] #include <conio.h> /* Or whatever header getch may be defined in …

Member Avatar for Dogtree
0
396
Member Avatar for Tokyoprince

The more protection the better, in my opinon, especially if you're using an "always on" broadband connection, and even more so if you have a static IP. You can set up your router's firewall through the browser interface, usually by opening your web browser and punching in the address of …

Member Avatar for Dogtree
0
68
Member Avatar for Sam Lehman

You can call an external program with the system() function: [code] #include <stdlib.h> system("DIR"); [/code] But that's probably not what you want since you need the output. In that case, you need to create a pipe either through the [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/createpipe.asp]Win32 API[/url], or with a compiler extension if supported. For example, …

Member Avatar for Sam Lehman
0
273
Member Avatar for Wenshere

A much safer way to get an array of strings is with the standard vector and string classes: [code] #include <iostream> #include <string> #include <vector> int main() { std::vector<std::string> a; a.push_back("qwerty"); std::cout<< a[0] <<std::endl; } [/code]

Member Avatar for Dogtree
0
113
Member Avatar for Wenshere

>>1, who can tell me the defference between "cerr" and "cout"? cerr is effectively unbuffered, where the stream is flushed after every output operation. cout is not required to do this. >>7/0 is wrong,but I will let the codes continue, that is , let the result of 7/3 output. That's …

Member Avatar for Dogtree
0
139

The End.