dkalita 110 Posting Pro in Training

use while(1) loop and inside the loop read one character at a time.
Break from the loop on getting something other that 0-9.
Handle the space explicitly.
If the numbers are multi-digit numbers you will have to use temp buffer to store the number till u get a space.

WaltP commented: Terrible suggestion -4
dkalita 110 Posting Pro in Training

Hi
Can anyone help me in suggesting how to prevent "out of memory" exception in java. I am getting this exception when I load a very large data in my application and after running the application for sometime the application throws this exception. I want to know if there is any way (such as some parellel thread) that will keep a check for the maximum memory and when the application crosses some threshold (set manually) it will show some popup and exit instead of hanging the application.
Please suggest.
thanks

dkalita 110 Posting Pro in Training

may be u can display using cout as

string str;
char *buf = (char *)&str;
/*u need to know the size of 'str'*/
/*sizeof(str) might work but m not sure about it*/
int i;
for(i=0;i<sizeof(str);i++)/*considering sizeof() works*/
    cout<<(unsigned short)*(buf+i)<<",";

I dont know any feature in KDev for displaying the buffer coz I never worked in that. :)

Hope that helps a bit.

dkalita 110 Posting Pro in Training

i would like to know the way we can make user enter a number in a menu reply perhaps so that he doesnt have to press the enter key...........i.e. the program automatically proceeds with the give value and doesnt wait for an enter key to be pressed. its easy in foxpro but i dont know the way to do it in C.

use getch()

dkalita 110 Posting Pro in Training

ok, i understand now, that it will not do putchar(' ') because the START has true value, so it will ignore all the white spaces until the first letter :)

but how to manage, that the output won't end with one space as it ends in this case.. i cant figure out how to replace last white space with \0, any ideas ?

use one more flag for that as

#define FALSE 0
#define TRUE 1

void VymazBiele()
{
int c;
    int start= TRUE;
    int spacePrinted=FALSE;
    while ( (c = getchar() ) != EOF )
    {
        if (isspace(c))
        {
          spacePrinted = FALSE;
          while ( (c = getchar() ) != EOF && isspace(c))
          {}
        }
          if (c != EOF)
          {
                if(start==FALSE && spacePrinted==FALSE)
                {
                       putchar(' ');
                       spacePrinted = TRUE;
                }
                putchar(c);
                start = FALSE;
          }
    }
}
dkalita 110 Posting Pro in Training
string name="";

u can write

string name;
dkalita 110 Posting Pro in Training
fourMatrix(fourVector &i, fourVector &j, fourVector &k, fourVector &l): i(i),j(j),k(k),l(l){	}	
fourMatrix(fourVector i, fourVector j, fourVector k, fourVector l): i(i),j(j),k(k),l(l){

those two are the same prototype.U can declare only one of them.

Let me explain:

Say u have two functions:

void test(int x);
void test(int &x);

when u invoke them

int c=3;
test(c);

which function should get invoked?

This bring ambiguity. Read the error properly that u had which clearly said that.


home/mark/Vega_lib/Source/Geom.h:52: error: call of overloaded ‘fourMatrix(fourVector&, fourVector&, fourVector&, fourVector&)’ is ambiguous
/home/mark/Vega_lib/Source/Geom.h:7: note: candidates are: fourMatrix::fourMatrix(fourVector, fourVector, fourVector, fourVector)
/home/mark/Vega_lib/Source/Geom.h:5: note: fourMatrix::fourMatrix(fourVector&, fourVector&, fourVector&, fourVector&)

dkalita 110 Posting Pro in Training

Hi
Can anyone help me in extracting all the tables and its contents that are present in a MS word document using c++ or C