User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 455,996 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,845 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 500
Search took 0.06 seconds.
Posts Made By: vijayan121
Forum: C++ 21 Hours Ago
Replies: 1
Views: 54
Posted By vijayan121
Re: UDP-Sockets chat application question

First, is this the "best" way to tackle the chat problem?

no. it is unlikely that someone would want to set up a chat between two processes on the same machine, sharing stdin and stdout between...
Forum: C++ 21 Hours Ago
Replies: 3
Views: 58
Posted By vijayan121
Re: error dynamic_cast in c++

you need to enable RTTI. (use compiler switches for this.)
either you have turned it off by using the switch /GR-
or you are using a fairly old version of the microsoft compiler.
turn it on with the...
Forum: C++ 2 Days Ago
Replies: 1
Views: 74
Posted By vijayan121
Re: cyclic codes help

read the following pages and you should be...
Forum: C++ 2 Days Ago
Replies: 2
Views: 77
Posted By vijayan121
Re: Creating a memory mapped file

> man mmap <Enter>
at the command prompt on your system. it should give you all the information that you require.you would see something like this:...
Forum: C++ 4 Days Ago
Replies: 3
Views: 90
Posted By vijayan121
Re: Hiding an Assignment Operator

> declare it as private and just leave an empty implementation?
ideally, declare it as private and do not define it.

> Is this common/useful?
useful, yes. common, not all that much.
if there is a...
Forum: C++ 4 Days Ago
Replies: 2
Views: 348
Posted By vijayan121
Re: How to download file from internet?

> It keeps saying:
> Failed to connect with the server : Bad file descriptor

that says all that needs to be said, doesn't it?
int websock; // websock is an uninitialized int

webaddress.sin_family =...
Forum: C++ 11 Days Ago
Replies: 7
Views: 189
Posted By vijayan121
Re: overload << for a base class

struct base
{
virtual std::ostream& write( std::ostream& stm ) const = 0 ;
// ...
};

inline std::ostream& operator<< ( std::ostream& stm, const base& object )
{
return object.write( stm ) ;...
Forum: C++ 13 Days Ago
Replies: 3
Views: 143
Posted By vijayan121
Re: returning template container from function!!! how?

this is broken when C is a const container.
c.begin() and c.end() returns objects of type C::const_iterator.

in C++98 you would have to do something like
template < typename CNTR > struct...
Forum: C++ 14 Days Ago
Replies: 1
Views: 92
Posted By vijayan121
Re: Help with Explicit parameter polymorhphism

have a look at the standard header <utility>. it defines std::pair and std::make_pair.

template <typename First, typename Second>
struct Pair
{
First f;
Second s;
Pair( const First& ff,...
Forum: C++ 18 Days Ago
Replies: 1
Views: 154
Posted By vijayan121
Re: Hack Tool Development

bulk rename of all the .wav files in one go and updating the text in all the .phr files at another time can leave you in a messy state in the event of a crash (you would have to restart all over...
Forum: C++ Sep 28th, 2008
Replies: 6
Views: 332
Posted By vijayan121
Re: wired knapsack...

the general knapsack problem and the subset sum problem are NP-hard, but not NP-incomplete. so there are no polynomial-time algorithms. but it is one of the easy NP-complete problems to solve.

it...
Forum: C++ Sep 28th, 2008
Replies: 11
Views: 456
Posted By vijayan121
Re: Const Question - Why is this happening?

this is nothing specific to constructors or passing parameters to functions.
it is just the application of the C++ rules for resolving a call to an overloaded function.
#include <iostream>

void...
Forum: C++ Sep 26th, 2008
Replies: 2
Views: 152
Posted By vijayan121
Re: a few questions about C++ source code

> #pragma - what does it mean
to understand what #pragma is see: http://msdn.microsoft.com/en-us/library/d9x1s805(vs.71).aspx
for the specific #pragma directives that are in your code, refer to your...
Forum: C++ Sep 26th, 2008
Replies: 2
Views: 158
Posted By vijayan121
Re: Container Adapter Confusion

have each of the two stacks to store a reference to a std::deque.
initialize them to refer to the same std::deque.
write a wrapper class to hold the two stacks.

template< typename T > struct...
Forum: C++ Sep 26th, 2008
Replies: 9
Views: 316
Posted By vijayan121
Re: Fast Conversions

writing a convert function (with construction and destruction of a stringstream each time it is called) would give more maintainable code. even in this case, the performance seems to be...
Forum: C++ Sep 26th, 2008
Replies: 9
Views: 316
Posted By vijayan121
Re: Fast Conversions

only because the language the OP is using ( MessageBox::Show ) is C++/CLI (not ISO C++).
and purely managed will not give anywhere near native performance.
Forum: C++ Sep 26th, 2008
Replies: 7
Views: 241
Posted By vijayan121
Re: help with stream files

in adition, change int size = 100; to const int size = 100;
size of an array must be a constant known at compile time.
Forum: C++ Sep 26th, 2008
Replies: 9
Views: 316
Posted By vijayan121
Re: Fast Conversions

> What I look for now is a fast way to convert from double to char*
> I have a problem to find this conversion.

a. compile C++ source to generate native code, not IL that is interpreted at run-time....
Forum: C++ Sep 17th, 2008
Replies: 4
Views: 368
Posted By vijayan121
Re: Constructor function call problem

consider using the std::tr1 polymorphic function wrappers. this would allow using free functions, member functions and function objects in a polymorphic way.

if your compiler does not ship with tr1,...
Forum: C++ Sep 17th, 2008
Replies: 7
Views: 373
Posted By vijayan121
Re: template function overloading

> But I still find it ackward, that there are no possibility to do it.
> I can handle special cases when, I have different INPARS as long as the method is void.
> But it's not possible to do it when...
Forum: C++ Sep 17th, 2008
Replies: 2
Views: 199
Posted By vijayan121
Re: Need help using shared_ptr

a std::tr1::shared_ptr cannot correctly hold a pointer to a dynamically allocated array. AFAIK, there is no such smart pointer in tr1.
you could use boost::shared_array (tr2) instead....
Forum: C++ Sep 16th, 2008
Replies: 14
Views: 560
Posted By vijayan121
Re: this pointer

> the self-assignment test does not work well in class hierarchies either,
> even with use of boost::addressof().

it is unlikely that using value semantics on object-oriented types is something...
Forum: C++ Sep 16th, 2008
Replies: 4
Views: 288
Posted By vijayan121
Re: Rounding function

perhaps the easiest way is to use the iostream formatted output facilities:
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>

int main()
{
double a = 2.5632, b = 2.5652 ;
Forum: C++ Sep 16th, 2008
Replies: 8
Views: 325
Posted By vijayan121
Re: Arguments and strings

a little less verbose, and a little more efficient:
#include <vector>
#include <string>

int main ( int argc, char** argv )
{
std::vector< std::string > arguments( argv, argv+argc ) ;
}
Forum: C++ Sep 16th, 2008
Replies: 14
Views: 560
Posted By vijayan121
Re: this pointer

>> The above is common practice, but it is easily broken.
>> Imagine, for example, a class that supports its own operator&() ...
>> The most useful way I've found to do an assignment operator is;...
Forum: C++ Sep 16th, 2008
Replies: 9
Views: 390
Posted By vijayan121
Re: can stdio.h be in one program with iostream.h?

for the predefined streams, it's safe to mix C stdio and C++ iostreams. you can safely use stdin and std::cin in the same program; the C++ Standard guarantees that it will work the way you would...
Forum: C++ Aug 31st, 2008
Replies: 1
Views: 218
Posted By vijayan121
Re: Problem with destructor

> As a destructor releases memory for an object ...
a destructor does not release memory. it deinitializes an object and after it executes, what is left is uninitialized memory (earlier occupied by...
Forum: C++ Aug 31st, 2008
Replies: 8
Views: 876
Posted By vijayan121
Re: shift (bitshift) through char array

> i would like to avoid doing 4 times 2 shift for each char.
> For each char i do 4 shift operations and 4 bitwise AND's, thats 8 bitwise operations.

you can reduce it to just 4 AND operations by...
Forum: C++ Aug 29th, 2008
Replies: 7
Views: 240
Posted By vijayan121
Re: Simple Source Control

also have a look at codeville http://codeville.org/
it is one one of the easiest to use.
Forum: C++ Aug 29th, 2008
Replies: 6
Views: 318
Posted By vijayan121
Re: Does it need a copy constructor and an operator= for a class which have array mem

you can answer this yourself if you write a small test program and run it. for example:
#include <iostream>

struct A
{
A() { std::cout << "A::default constructor\n" ; }
A( const A& ) {...
Forum: C++ Aug 28th, 2008
Replies: 3
Views: 229
Posted By vijayan121
Re: Design Problem: Dealing with multiple time frames

> Does it make sense to write a virtual method in the templated base class
> in order to force derived classes to have an appropriate addelement() method?
no. the polymorphism provided by templates...
Forum: C++ Aug 28th, 2008
Replies: 15
Views: 1,392
Posted By vijayan121
Re: Array with Variable Size in a Structure

measurements for the same snippet (3 each) for the microsoft compilers:

compiler: VC++ 9.0 (Express 2008)
optimizations: /Ox /Ob2 /Oi /Ot /Oy /GT /GL
processor: Intel Pentium M 1.86 GHz

c array:...
Forum: C++ Aug 28th, 2008
Replies: 3
Views: 229
Posted By vijayan121
Re: Design Problem: Dealing with multiple time frames

if you absolutely need a base class Chart (with virtual functions), a hack would be to overload the AddElement function.

i would prefer using templates for your containers as suggested by Narue in...
Forum: C++ Aug 27th, 2008
Replies: 15
Views: 1,392
Posted By vijayan121
Re: Array with Variable Size in a Structure

valarrays were introduced with the idea that it might encourage C++ compiler developers for vector processors to implement them as built-in types (the compiler could emit code to optimize the use of...
Forum: C++ Aug 25th, 2008
Replies: 6
Views: 325
Posted By vijayan121
Re: Changing the Access Specifier in Virtual Functions

Derived d;
Base *p = reinterpret_cast< Base*>(&d);
> I found that this is also legal--

it will compile.
it will work correctly if and only if the anonymous base class sub-object is at an offset of...
Forum: C++ Aug 25th, 2008
Replies: 9
Views: 338
Posted By vijayan121
Re: algorithmic problem...

any 3-combination of the N-set would consist of numbers at 3 different positions in the array; you could choose positions i,j,k out of these three such that i<j<k holds.

so doesn't the problem...
Forum: C++ Aug 24th, 2008
Replies: 3
Views: 220
Posted By vijayan121
Re: Search Function Troubles

> Could it be because i am entering the string 'key' with spaces?
yes
> how would i fix it?
use std::getline
http://www.cppreference.com/cppstring/getline.html
Forum: C++ Aug 23rd, 2008
Replies: 3
Views: 532
Posted By vijayan121
Re: union vs reinterpret_cast<>()

> Is there any real different between using an union between two types and a reinterpret_cast between two types
yes, there are quite a lot of differences.
a union reinterprets the layout of memory...
Forum: C++ Aug 21st, 2008
Replies: 3
Views: 338
Posted By vijayan121
Re: c++ - runtime check failure - what's wrong with this code ?

if your idea was to have a code sample which will help you understand how virtual function calls are implemented by the microsoft compiler:
#include <iostream>

#if defined(_MSC_VER) && (_MSC_VER >=...
Forum: C++ Aug 18th, 2008
Replies: 7
Views: 368
Posted By vijayan121
Re: "Taking an address"

see IS 9.4.2/4


GCC is conforming. static constant member object is 'used' (in main) and, therefore, has to be defined.

the main issue here is that if you take the address, the static object has...
Showing results 1 to 40 of 500

 
All times are GMT -4. The time now is 9:42 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC