siddhant3s 1,429 Practically a Posting Shark

First make sure you have the file on your disk in proper format.
Now look closely, at the itsAboutYou2 code, you already have read the file to all the variables right?
Now you need to display on screen. So you can use cout.
Just add

cout << endl;
cout << age << endl;
cout << gpa << endl;
cout << name << endl;
cout << gender << endl

after fin.close() and it will run.(it is running on my pc atleas)

siddhant3s 1,429 Practically a Posting Shark

This is the Error I get when running your program on g++ with -Wall flag on,phillipdaw is: ISO C++ forbids taking address of function ‘::main’ So, I guess that answered all the doubts regarding calling of main(). So the rule of thumb: NEVER CALL MAIN()

Rather than exit(0), you can use return(0), if you want to exit the program from main.

siddhant3s 1,429 Practically a Posting Shark

#include<conio.h> ?
conio.h is not standard header. Don't include it. Why do you need it?

siddhant3s 1,429 Practically a Posting Shark
// print output
  ofstream fout;
  fout.open("aboutYou.txt", ios::app); 
  fout << endl;
  fout << age << endl;
  fout << gpa << endl;
  fout << name << endl;
  fout << gender << endl;

You told me that output should go to the screen, right? Then just tell me why are you outputting to fout? use cout instead.

cout << endl;
cout << age << endl;
cout << gpa << endl;
cout << name << endl;
cout << gender << endl
siddhant3s 1,429 Practically a Posting Shark

Ignore the above post please.

Postfix notation is evaluated from left to right.
What your algo was: if say the expression is 22/2+1+, you were calculating 2/2+1 first. which ofcourse dont make any sense.
Rather you should calculate 22/ first and then replace it in the main expression by its value(which is 1).

So, here is your code with few modification. Comments has been added. If you need more explanation, reply here. The only draw back is that at no point of time, the value of any expression exceed one digit.

#include<iostream>
#include<string>
#include<sstream>
using namespace std;
//stringify just converts a int to string
inline string stringify(double x)
{
    ostringstream o;
    if (!(o << x))
        cout<<"Stringify::Bad Conversion";
    return o.str();
}

int postfix(string s)
{
    cout<<"New Postfix:"<<s<<endl; // for debug
    int a, b;
    if ( !isdigit(s[2]) && isdigit(s[0]))//check if the first three charactrs can be evaluated
    {
        //now if the length is greater than three, replace the first three with the value
        if (s.length() > 3 )
            return postfix(s.replace(0,3,stringify(postfix(s.substr(0,3)))));
        else if (s.length()==3)//elseif the length is 3
        {
            
            cout<<"Inside If:"<<endl; // for debug
            a = s[0]-48;
            b = s[1]-48;
            cout<<"eval "<<a<<" "<<s[2]<<" "<<b<<endl;
            switch (s[2])
            {
            case '+':

                return a + b;
            case '-':
                return a - b;
            case '*':
                return a * b;
            case '/':
                return a / b;
            default :
                cout<<"bad input\n";

            }
        }
        else //just a error check in case ;)
            cout<<"Too short to evaluate(min is 3)";

    }

    else
    {
        cout<<"theElsepart:"<<s.substr(1,3)<<endl;//ForDebugging
        //This needs explaination: …
siddhant3s 1,429 Practically a Posting Shark

I have little bit modified your code and it is working. The only drawback is that it cannot handle more than one digit nos. at any point of time during calculation.
I have commented the code and am sure that you will understand it.
Though, I will explain it completely in a short while.

#include<iostream>
#include<string>
#include<sstream>
using namespace std;
//stringify just converts a int to string
inline string stringify(double x)
{
    ostringstream o;
    if (!(o << x))
        cout<<"Stringify::Bad Conversion";
    return o.str();
}

int postfix(string s)
{
    cout<<"New Postfix:"<<s<<endl; // for debug
    int a, b;
    if (s.length() == 3 && !isdigit(s[s.length()-1] && isdigit(s[s.length()-2])))
    {
        cout<<"Inside If:"<<endl; // for debug
        a = s[0]-48;
        b = s[1]-48;
        cout<<"eval "<<a<<" "<<s[2]<<" "<<b<<endl;
        switch (s[2])
        {
        case '+':

            return a + b;
        case '-':
            return a - b;
        case '*':
            return a * b;
        case '/':
            return a / b;
        default :
            cout<<"bad input\n";
        }
    }
    else
    {
        cout<<"theElsepart:"<<s.substr(1,3)<<endl;//ForDebugging
        //This needs explaination:
        //Lets say the the expression was "262/3*+"
        //Now, I am replacing the "62/" to its value by
        //calling postfix() again on "62/"

        return postfix(s.replace(1,3,stringify(postfix(s.substr(1,3)))));
    }
    return 0; // This return is for debug
}
int main()
{
    cout<<postfix("263+*");
}
siddhant3s 1,429 Practically a Posting Shark

>Yeah I know, this instanciation + use of Printer here looks definitely dodgy.
You are using dynamic memory management using new. Be sure to free the memory with delete.
>Why do I get these errors?
These are the Linking error you are getting.
Its probable that you are not including the implementation file of your header file while linking.
use this if you are on g++

g++ -o final.exe main.cpp RandomGenerator.cpp Printer.cpp

>What about the way I include file?
Generally, you write a header file(declarations) and a implementation .cpp file(definitions). Then what you usually do is, you compile the .cpp files of all the header file separately(in your case you need to compile RandomGenerator.cpp and Printer.cpp separately).Remember I said ONLY COMPILE, which can be done by the -c flag like this:

g++ -c -o RandomGenerator.o RandomGenerator.cpp
g++ -c -o Printer.o Printer.cpp

and you get two binary .o files. You can distribute the .h file and these .o files to anyone who purchases your class.(and you can also keep it open-source by giving the person the .cpp file too)
Pre-compiling helps in two ways:
1.It make your code encrypted hence it is hard to get the original source by reverse engineering it. Thus you dont need to give anyone your full source.
2.It saves the time in compiling those .cpp file since they are already compiled now.
Hence you should, after compiling those .o files, have to link while …

siddhant3s 1,429 Practically a Posting Shark

what i have read that ++c or c++ returns a value which can't be again incremented or decremented (like 5++).
.

You have read wrong.
You are though right by saying both of these operator returns a vale, but the pre-fix(++x) return that value by reference. That means it can be on the left side of assignment operator.

//although the code is meaningless but then too..........
int i=1,y=0;
i++++;
cout<<i;

Search what do Return by reference means

siddhant3s 1,429 Practically a Posting Shark

I've never done this, but it doesn't look you passed any arguments

You are right. he has just called the program without any command line argument.
Also, you answered it rightly to him.
As a matter of explanation: the system() function takes a Cstring and pass it to the command prompt( or terminal or shell for Linux user) and then returns a value which is platform dependent.
So, while using system(), assume as if you were typing everything at the command prompt.
So, the correct thing as daviddoria said, will be: system("FileName.exe arg1 arg2"); Also this is even good:

std::string s1;
getline(std::cin,s1);//take command from user
system(s1.c_str());//pass it to the shell
siddhant3s 1,429 Practically a Posting Shark

Hope this helps...

Yeah, it will surely help him. He will copy-paste the code and will forget where he committed mistake.:angry:
Did you tried explaining him where he went wrong
Please note:
I know no one gets paid to help here. I even know that you can debug the flawed code very quickly and repost it. But the real pain lies in explaining the things to the new-bie so that he can get meaning to your code.

So now regarding the code tyoung4@runner
look at for (hours = 1; hours <= mph; hours++) . You already had some value in hours which you took from user, right? And look what you did, you made the hours=1 which mean that the previous value has been lost!. So, rather use what tux4life did.

Moreover, I dont think the second statement of

cout << " ---------------------------------- " << endl;
cout << hours << "\t\t" << distance << endl;

means anything.

Also, dont use system("clear") . Why? Because using system() makes your code unportable. For eg: On windows you use system("cls") while on Linux, you will have to use system("clear"); So take it from me, don't use system()

tux4life commented: You made a good point here! +1
siddhant3s 1,429 Practically a Posting Shark

>>the popular definition of copy-constructor is ... myType(myType&)
I just wanted to emphasize on call by reference thing. Sure this defination is bad without a const modifer. As you can see, I have used the const specifier in my code.
ArkM is right.
Let's see what good the const declaration do to us. Say, you have a copy constructor whose arguments are taken as const-and-by-reference

Class(const Class& copyFrom)
{

//do something to copy
copyFrom=3;//error copyFrom is const, it cannot change
}

As commented above, the compiler causes a error at compile time.
Often such assignments are typographical errors.
Thus, you are saved by scratching your head at the run-time.
As a rule of thumb, it is always good to catch error in compile time itself.

siddhant3s 1,429 Practically a Posting Shark

How to get information about big nums can you help me with searching...
thanks in advance ...

Atleast try searching. Google is your friend.
BTW, you can start somewhere here:
http://www.google.co.in/search?q=implementation+of+big+numbers+in+c%2B%2B
http://www.daniweb.com/forums/newpostinthread176976.html
http://ittb.pcriot.com/forum/viewtopic.php?t=23

siddhant3s 1,429 Practically a Posting Shark

Lets say if I issue the following statement:

A Inst(4);//Constructor of Inst called with parameter 4
Inst=A(3);//Constructor of temp object(not Inst) called with parameter 3. Also
                 //the assignment operator of Inst called with temp object
                 //as parameter

So, clearly the two Constructor calls which you see as your output are from different object. The first one is from Inst and second one from the temp object.
The one Destructor call is coming from the temp object.

Because, if I use the copy constructor or assignment the object needs to be constructed twice

No. the popular definition of copy-constructor is :

class myType
{
private:
int a;
public:
mType(myType& copyFrom) //this is copy constructor
{
a=copyFrom.a;//copying
}
};

As you can see the value is passed by reference. Hence there will not be any copy of the copyFrom object.

Now, for your problem, the most probable copy constructor and assignment operator will look as below:

#include<iostream>
using std::cout;
using std::endl;
class A
{
public:
    int *Int;
    A()    {Int = new int;}
    A(int b)
    {
        Int = new int(b);
        cout << "one-argument CONSTRUCTOR " <<endl;
    }
    A(const A &copyFrom)
    {
        Int = new int;
        *Int=*copyFrom.Int;
        cout<<"Calling Copy Constructor"<<endl;

    }
    A& operator = (const A & copyFrom)
    {
        *Int=*copyFrom.Int;
        cout<<"Calling Assignment Operator"<<endl;
        return *this;
    }

    ~A()
    {
        delete Int;
        cout << "DESTRUCTOR" << endl;
    }
};

int main()
{
    A Inst(1);
    Inst=A(5);
    cout << *Inst.Int << endl;

    A Binst=Inst;

    cout << *Inst.Int << endl;
}

Output:


       
siddhant3s 1,429 Practically a Posting Shark

It is calling the Constructor too!
That's why you are getting output as two Constructor's and one Constructors..

CONSTRUCTOR //this is from A Inst(3);
CONSTRUCTOR // Inst = A(4);
DESTRUCTOR//from Inst = A(4);
0

siddhant3s 1,429 Practically a Posting Shark

Yes, it will be the same output. Can you guess why?
This is called Implicit type conversion. In this case the statement Inst = 4; is equivalent to Inst=(A)4; which is doing the same thing.

So, how do I change Inst the "correct" way?

You should define your own copy-constructor, your own assignment operator to eradicate the problem completely.

siddhant3s 1,429 Practically a Posting Shark

You are actually doing crime here but letting the compiler generate the copy constructor and the assignment operator,
Look closely what Inst = A(4); do(sorry Comatose, I am answering that):
On the right side of the assignment operator, a temporary object is created, a copy constructor is called which copy the value of all the member of that temporary object to Inst and then, listen up, call the destructor of that temporary object.
Now as the destructor deletes the memory assigned to Int, the value of *Int is shown as zero(actually it is undefined). Now again as you program terminates, the destructor of Inst is called, which tries to delete a pointer which is already passed to delete once. And so, your program gets screwed up( the second delete, actually throws an exception, which is un-catched)

.

Comatose commented: Precisely. :) +11
siddhant3s 1,429 Practically a Posting Shark

I'd say the pain is actually a little lower. :D

Lower? hmm, may be, it is personal taste or something. I mean handling pointer's to pointers, and freeing them from memory, off course is a bonus effort.
Anyway....... but the vectors rock!!

siddhant3s 1,429 Practically a Posting Shark

A quick point to note is that g++(and other compiler that support c99) allow VLA(Variable Length Arrays), if which you can specify a variable as the length of the array. i.e. the following statement are valid

int a,b;
cin>>a>>b;
int arr[a][b];

But then, the C99 standards are not implemented by some compiler's like few from Microsoft. So rather do not use them as the code will not be portable.
Regarding your problem, use vectors of vectors instead of a 2-dim array.
But if you insist on arrays, be ready to scratch your head a bit, as multi-dim dynamic array can be a back pain.

siddhant3s 1,429 Practically a Posting Shark
int main()
{
	Coord a;//this thing is the trouble maker

Do you realize that you want to create object without giving any parameter. This was good if you had defined a no-argument constructor.
Although, there was no need for a no-argument constructor as the compiler generates auto-magically for you but only when, here is the key, you have not defined any type of constructor by yourself. Here you have already defined a two-argument constructor and hence the compiler wont generate any default constructor.
Now you have three choices,
1. Define a no-argument constructor.
2. Create your objects by Coord a(0.0,0.0)
3. Delete your two argument constructor.

Plz search the forum before posting such issues.

siddhant3s 1,429 Practically a Posting Shark

Dude, first of all you didn't followed my advice, I said you not to modify your orignal post.
But anyways, if you look at your code again you will find that, there still is a file.open inside the loop. Moreover, the file.open() you have put outside the loop contains the ios::app
so now getting frustrated I am posting your code in corrected form:

ofstream file;
file.clear();//I dont know why you need this, u shd remove it
file.open("book.txt");
for (map<string,Person>::const_iterator it = adrbook.begin();
it != adrbook.end(); ++it) 
{
[INDENT]string name = it -> second.get_Name();
file << name;[/INDENT]
}
file.close();
siddhant3s 1,429 Practically a Posting Shark

Look at your code:

for (map<string,Person>::const_iterator it = adrbook.begin();
it != adrbook.end(); ++it) {
file.open("book.txt");

Do you realize that you have put the file.open() in a for loop.
And file.close() outside the loop ?
So the remedy is to put the file.open() outside the loop. And it would work just fine.

PS: I see you changing your code in your original post by using edit functionality. Don't do this. If anyone else will view this thread, it will avoid confusion to him. So, please don't change anything of your post after a reply has been given to it. In that case just re-submit it again

siddhant3s 1,429 Practically a Posting Shark
file.open("book.txt", ios::app);

Do you see that ios:app? It is telling the compiler to append whatever to book.txt
So, if you want to start afresh, just remover that ios::app tag
Use

file.open("book.txt",ios::trunc);

or you can even simply use

file.open("book.txt");
siddhant3s 1,429 Practically a Posting Shark

I remember I once made a similar code.
You can study that and see if it makes any benefit to you.
If any query regarding the code ask back.


The N Digit Calculator
http://ittb.pcriot.com/forum/viewtopic.php?t=23

siddhant3s 1,429 Practically a Posting Shark

Yes, GDICommander
It is (intend to be) a character by character copy.
But just look at the code, it is crap. Look at the loop, he is using .get() even in the output file.

siddhant3s 1,429 Practically a Posting Shark

Dude, #'s are Preprocessor directives. That means all of those things are done before compiling your code.
So here how it goes.
First, the preprocessor work on all the #'s and make the code ready for compilation
it doesnt even see your code. nor does the preprocessor knows c/c++.
It understands only macros i.e. all the #'s

After the preprocessor does its job, your code is then compiled by the compiler.

So getting the point?

rmlopes commented: The only post that would have been worth at the time, in this thread +1
siddhant3s 1,429 Practically a Posting Shark

Instead use strings.

Yeah, suerly I mean initialization.
As far as your second comment is concerned, look at the test condition, it says i<len-1 which means that the maximum value of i can be len-2.
So the loop will never come to the last character. Hence the i+1 will be actually the last character of string. Hence it is perfectly fine.

Though, I am sorry about the initialization part, I just wrote that outta hurry.

Ofcourse, I agree that using c++string is best.

siddhant3s 1,429 Practically a Posting Shark

Mate you dont need gotoxy(). Neither it is standard nor it is needed. I'll give you a hint which is already posted, use white space. It means to place required number of spaces (' ') before printing the characters :

______#
_____###
____#####
___#######
__#########

here the underscore should be actually spaces, but I have put them so that you know where the spaces shd come

siddhant3s 1,429 Practically a Posting Shark

line 20!!
shouldnt that be in a loop?
and why do you use so many useless variables(d,e,f,g,h). Just say
d=(n*(n+1))/2
sum2=pow(d,2)//squaring d

siddhant3s 1,429 Practically a Posting Shark

I want to use the low leveled BSD socket API in windows.
I searched a lot and now I am up.
I guess conditional compiling and wrapping my class is the best I can do.
I simply(though it is not so simple) want a way to use the BSD sockets in windows without using cygwin.(as in cygwin u can create apps with restricted lisense)

siddhant3s 1,429 Practically a Posting Shark

siddhant3s, it seems your wonderful post does not bear a relation to the original question about Object-C/C++ mixture ;)...

Oh sh*t,
I thought he meant it as object files of C,
:-/

Anyways. I wasted typing so much :@ I guess someone would be helped while google indexes dani very efficiently!!!
Its upto the moderator to do whatever with my post:
stupid me:$

siddhant3s 1,429 Practically a Posting Shark

First follow the Ancient Dragon comment.
then parse the whole string by checking each letter, run a for loop.
I dont know if your using c++ string or cstrings. I am explaining using cstring

char str[MAX];
cin.getline(str,MAX);
int len=strlen(str);
for(int i;i<len-1;i++)//run till lenght -1
{
if(str[i]=' ')
toupper(str[i+1]);
}
siddhant3s 1,429 Practically a Posting Shark

I agree with, VernonDozier.
cin>> is already overloaded for you to input the right thing.
cin.get is a unformated input function. It does not format the input accordingly. It is just used for char
heres the prototype

get ( char* s, streamsize n );
siddhant3s 1,429 Practically a Posting Shark

Look,
Here's the key:
If you do dont provide any constructor to the Class, the compiler generates, automatically, a defalt no-argument constructor.
But, if define even one constructor yourself, the compiler won't generate any constructor for you.
Saying this, I mean that if you defined a 2 argument constructor and no other constructor is defined, you cannot create object without specifying those two arguments. You have two options, either define a dummy no-argument constructor, or use the default arguments in your 2-argument constructor.

siddhant3s 1,429 Practically a Posting Shark

On ArkM's post,
Please try not to give the full answer in your post.

siddhant3s 1,429 Practically a Posting Shark

What I am guessing is that you dont have the source of of the .obj(or .o) file.
Don't worry. If you know what all prototypes where there in the source file, you can create a header file which have all the prototypes and then compile it. It will compile easily. But when you are linking, be sure to link the object file along the header file and your main source file.
I know its getting bit confusing so heres a brief example.
Lets say the object file contains a structure and a function

someobj.c

struct myType
{
int a;
float b;
};

int f1(myType x)
{
return( x.a);
}

But you dont have the code have the code of the above file right? You just have the precompiled obj file( which will be a .o file or a .obj file).

Now I want you to create a new file containing the prototype(not the definition) of all the data structure and function used. In our example this will be:
myobj.h

struct myType;
int f1(myType);

Now just include the myobj.h in your main cpp program
main.cpp

#include<iostream>
#include "myobj.h"
using namespace std;
int main()
{
some code 
return 0;
}

Now compile the main.cpp. In g++ you compile with the compile only flag -c

g++ -c  main.cpp

And then you link the main.o and the myobj.o together to make your executable

g++ -o mainProgram.exe main.o myobj.o

And you are done;

siddhant3s 1,429 Practically a Posting Shark

First of all, thank you very much for such a decent reply.

I thought GNU provide everything open source, so can I get source code of socket.h(I mean the definition file) from them and probably compile it with MinGW?

See, I may be sounding as if I am desperate to use the sys/socket.h for all my socket apps even at win32. The point is, that I am really desperate to use it.

I don't want to go to cygwin because I am in a conception/misconception that I cannot develop non-free propertied software in cygwin, Plus I will have a burden to ship cygwin.dll with every app that I make.

So, for me, cygwin is a complete no-no.

If you have any other alternative, please let me know.

From your reply, it seems the only option left is to make a wrapper class and do all the dirty work in it(like conditional compiling etc.) and then use it for both Unix and win32.

siddhant3s 1,429 Practically a Posting Shark

If everyone is giving opinions, I would also cast my vote to GNU GCC
If you are on a Linux, you probably already know about it.
GNU g++ is the command line compiler. But there exists various IDE like Dev-C++ which uses GNU g++ as the compiler.
I personally use a normal Text Editor and Commandline.
But you may also like to have a look at CodeBlocks which is a free IDE.
On windows, there exists MinGW as a port of G++.

So, if you ask me a good compiler on windows, my opinion goes with
MinGW gcc, with CodeBlocks
http://www.codeblocks.org/downloads/5


Although, compiler's completely depends on taste of the programer.

I am sorry ArkM , I didnt notice you already have told him about GNU g++

siddhant3s 1,429 Practically a Posting Shark

You got this code from a C++ Teacher? LOL Does'nt look like

Anyways, I prefer you should first read about files and streams rather than geting a readymade answer.
I can answer you thingy, I cam remake your whole code also, but then there is no point in doing it if you don't know about files in C++.

Go and read a text book. By the way, what text book are you consulting?
The program here is not at all tough, I am sure you will understand it( and will able to correct it too) once you know more about C++

So go and read Files and Streams in C++ as it is a important part in studying C++

siddhant3s 1,429 Practically a Posting Shark
siddhant3s 1,429 Practically a Posting Shark

I guess you want to count the number of vowels, consonants etc.
Good,
you are almost there, lets look what wrong you did. I am referring to your orignal code.

cin.getline(len i,80);

This is totally wrong,
the syntax is

cin.getline(cstring,MAXINPUT)

So, in your case it should have been

cin.getline(line,80);

Next:
len is uninitialized, i.e. it contains junk values. Initialize it using strlen(line). strlen() is a function (in string.h) which returns the length of the string.
strlen("hello")=5

Next problem is the loop condition:

for(i=0;line[len]!=10;len++)

i is not defined use k instead. Moreover the condition is wrong, it should be (k<len). also, len++ is wrong, use k++
So the loop becomes

for(k=0;k<len;k++)

I also encourage you to use isalpha() which tells you if a character is a Alphabet.

It seems that you are very new to the language. Never mind, everyone starts from one.
But always remember to use standard compilers. I understand your school force you to use a nonstandard compiler like TC++ but then too its never too late to switch. Read :http://cppdb.blogspot.com/2008/10/why-you-shouldnt-use-you-use-old-c.html

Also, I know I have not explained every bit of your code to you. But if you require explanation in detail, feel free to ask.
Thank U

siddhant3s 1,429 Practically a Posting Shark

If you are using C++ <string>

string s1;
cin>>s1;
fstream fio(s1.c_str(), ios::in | ios::out | ios::binary | ios::trunc);

But if you are using an old compiler, Like Turbo C++(although, I recommend you to switch to a new compiler, Read the Article :http://cppdb.blogspot.com/2008/10/why-you-shouldnt-use-you-use-old-c.html)

char s1[50];
cin>>s1;
fstream fio(s1, ios::in | ios::out | ios::binary | ios::trunc);

Please Mark the thread as Solved:

siddhant3s 1,429 Practically a Posting Shark

What are you trying to accomplish?
Can you be more descriptive?

siddhant3s 1,429 Practically a Posting Shark

pos+1 ??
should it be pos-1?

For say if array is int arr= {5,4,8,7}
and you are checking at position 4 i.e 7,
then you should do arr[3] and no arr[5] since
arr[3]=7
also, arr[5] is not equal to 7 but it contains some junk values!!

so just change pos+1 to pos-1 and then chekc

siddhant3s 1,429 Practically a Posting Shark

I have read prior post on the forum but I came up with few specific questions about Porting Unix Socket(hereby calling it BSD socket) to Win32 Platform :

First of all, I am a native Linux C/C++ Programmer. I program in Ubuntu with GCC.
But, I usually also port my application to Win32. For that, I use the MinGW Port of GCC. I never have troubles, as I just need to compile my apps on a Windows Box with MinGW installed and I am on a go.

I don't use a IDE but a Text editor/Command Line combo.

In Linux, we have easy access to sys/socket.h, which is BSD socket library.
So, I never had trouble to program sockets on Linux.
But now, I need to port all those to Windows.
Ofcourse, I will use MinGW.
I tried to compile my simplest of the Socket Programing App on MinGW, but got the error of not having sys/socket.h.
I checked my header files in the MinGW include directory, but seriously there was no socket.h in the /sys/ directory.
Ofcourse, I could use VC++ or some other compiler and use the Winsok API(winsock.h) instead. But I dont want to use that since it will have me do a lot of conditional compiling(to make my app, platform independent) which I don't like.

Now here are my queries:
Can I just copy paste my /sys/socket.h from my Linux Box and paste it on …

siddhant3s 1,429 Practically a Posting Shark

You want to actually find out the PRIME factors i.e. expand the number as the product of prime numbers(2,3,5,7...)
So the easiest way would be what has been told by WaltP.

siddhant3s 1,429 Practically a Posting Shark

this pointer has its own use:
first of all if you are dealing in a big project, you may use the convention this-member to differentiate between the member of the same global identifiers.
Moreover, it increases the readability of the code.
Secondly, you may like to use it if u do operator overloading for your class, like when you are overloading the assignment operator, you could return the this pointer itself.

But then, it is a fact that pointer do mess things up. moreover, C++ STL provide you with all those things you will hardly need to know about pointers.
This is what encapsulation is. And thats why OOP rocks.

But then, understanding pointers have its own merits. So I prefer that you should probably read about it surely.

siddhant3s 1,429 Practically a Posting Shark

Thnk U;
return 1;
//I had done a lot of research before starting this thread;
//I dont ask Humans until I dont seriously find it on a Search Engine

siddhant3s 1,429 Practically a Posting Shark

You can even use the registry to specify command line options if you wanted to.

Kindly tell me how.....

siddhant3s 1,429 Practically a Posting Shark

So shd I do this:

int main(int argc, char* argv[])
ifstream ofile;
ofile.open(argv[1]);
.
.
.
.

If edit my registry to make the Windows Explorer call my applicaiton for .txts, will the first argument be the file name from which the program has been called?

siddhant3s 1,429 Practically a Posting Shark

Well you can go into your Windows Explorer, Folder Options, File Types set the default program to your program name for the types you want opened with your program. If you can open the file by using "Open With", this should work for you.

Well this i already know.
But my problem is to code my application so that it could respond to such actions.
I mean what code should I put on my app so that I can get the name of the file I have to open.