Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If US does not get involved, things are going to get ugly.

Put your money where your mouth is -- join the Marines and be the first to go over there to put your life on the line. What makes you think it is US responsibility to resolve their problems? Hell, we can't even resolve our own problems.

pritaeas commented: Well said. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can you emagine a world without the great pyramids? What a pitty for humanity if those 2,000 year-old objects were destroyed in a war.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

us should not take any military action, that's what united nations for.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post Form21.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

depends on the compiler. Generally, DEBUG is defined when you want to compile the program for debugging -- the compiler adds a great deal of symbol information and data so that you can use a debugger to single-step through the program and view the value of variables at any given time. All that is compiler dependent. With Microsoft Visual Studio you don't have to explicitly define DEBUG because the MS compiler with do that for you when you select Debug build (instead of Release build). DEBUG affects the entire program instead of just certain parts.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is how to refer to members of specific classes

int main()
{
    S2 obj;
    obj.A::x = 123;
    std::cout << obj.A::x;
    return 0;
}
nmakes commented: Thanks. THat's what I needed! :D +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Secondly.. Does the 'NEXT' pointer in the first node point just to a memory location of the second node

Yes, exactly right.

Intuitevly.. I would think that there would have to be some form of increment to identify each node

Yes, you have to create one so that the program can iterate through all the nodes

void foo(struct node* head)
{
    struct node* iterator; 

    iterator = head;
    while( iterator != NULL)
    {
        // do something

        iterator = iterator->next; // point to the next node
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For one, why is it that when this second node is instantiated it does not totally overwrite the first node?

Because they are in different memory locations. It's somewhat the same concept as declaring simple variables inside a function

void foo()
{
   int x; // one variable
   int z; // another variable
}

In the above example x and z are completely different variables with occupy different memory locations.

void foo()
{
   int* x = new int;
   int* z = new int;
}

The above example is almost the same as the first except the integers are allocated dynamically, each integer has a different memory location so tha one does not overwrite the other

struct node
{
    struct node* next;
}

void foo()
{
    int* head = NULL;

    struct node* newnode;
    newnode = new struct node; // allocate a node
    head = newnode; // save address in head
    newnode = new struct node; // allocate another node
    nead->next = newnode; // save it's memory location
    newnode = new struct node; // allocate another node
    nead->next->next = newnode; // save it's memory location
}

The above code allocates new memory for each node then saves those locations in the head node. After the address of the new node is stored in head we can throw away the address contained in newnode as it is no longer needed. Yes, the address in newnode is overwritten each time and that is why we have to …

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 20: fgets() parameters are all wrong. Read the description for that function here. I think you should just delete lines 20-23.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

From what I read I think Clang is just an IDE, but the description is somewhat confusing. The description calls it a front end in some places, meaning just an IDE, and a compiler in other places. It also says it's still under development, so it might not be very useful to anyone other than people who like to write compilers. If all you want to use it for is supprot for Regex you can get that with the Boost libraries.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is another take on that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

change them from int to unsigned int and see what happens. Also change bit1 to be 2 bits instead of 1.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I failed to mention that such a degree is worthless.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@Jim, you can do that in a lot of countries... it doesn't cost very much.

I think you can buy Ph.D. in USA

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could -- but you may never use that PC again. I hope you realize I was just joking :)

aVar++ commented: I was curious as I read somewhere a guy cleaned his motherboard with soap and water then let it dry, then you said it :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

or maybe this

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

one way to do it is to use strtok() to separate the original string into its individual parts (tokens). Call atoi() or atol() to convert each part to integer. Next, multiply the year and month by some factor of 10 so as to shift them left and make room for the next integer. For example, if the year is 2003 then multiply it by 10000 making it 20030000 which leaves room for month and day.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I thought service pack 5 fixed that, but if not here is a link to doc file that explains how to correct it. You will need either Microsoft Office (Word) or OpenOffice in order to read it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You didn't answer my original question -- have you installed Service Pack #5 or #6 for VC++ 6.0? There's no point in us trying to find your problem(s) if you haven't because the original compiler contains bugs in the file i/o header files. One of the bugs was that you had to press Enter twice for cin.

If you have not installed it, you need to download it from here and install it.

adil.ghori commented: thank you .. this is something i found out.. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why are you pressing Enter key twice?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here are some errors from VS 2012

c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(483): warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(487): warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1> Generating Code...
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(34): error C4700: uninitialized local variable 'selection' used
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(311): warning C4715: 'Cus' : not all control paths return a value
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(235): warning C4715: 'SaleR' : not all control paths return a value
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(450): warning C4715: 'Check' : not all control paths return a value
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(520): warning C4715: 'Mile' : not all control paths return a value

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

check line 265 -- all that is getting is one character, not the complete string.

line 288: why are you calling strlen() to do something that std::string.length() already gives you?

adil.ghori commented: thank you +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yes, but where in the program do the problems appear? tell us a line number or even a function name.

what have you attempted to fix the problems? I know the compiler has an excellent debugger, have you used it to single-step though the function(s) in order to find out what is causing the problems?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you will have to tell us what the error(s) are, no one is going to wade through all that code to find out.

Also, have you installed Service Pack #5 or #6 for that compiler? Without it the compiler and some of it's header files are very buggy. You might be better off downloading the free Visual Studio 2012 Express.

delete line 4 -- it's the same file as line 5.

delete line 13 -- line 12 is sufficient.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you have permissions to write to the folder? Are you using *nix or MS-Windows? Check the permissions of the folder which you are attempting to write the file to. Another hint is to turn off anitivirus program to see if that fixes the problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you try the code I posted? If yes, did it work or not?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Even if you could download the entire site, wouldn't you have to use a server such as Apache2 in order to browse it with a browser? And what about the database that the site might use, such as the one DaniWeb uses? Are you going to download the entire database files as well? That would probably mean violating the site's security because the database probably contains member names and passwords.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

all that does is save the current page, not the entire website.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I doubt that is possible without hacking the website, which is illegal and possibly get you a nice long prison sentence with free room, board and food for the rest of your life.

mmcdonald commented: Love it! +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I usually turn it off at night just before bedtime to help avoid wearing out the hard drive. I wore out one hard drive because I never (or rarely) turned it off. I also turn it off when there's an electrical storm outside, runed one computer that way too with an electrical surge.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thy this code:

    void concatenate()
    {
            FILE *f=fopen("aux.txt","w");
            if( f == NULL)
            {
                printf("Error opening aux.txt file\n");
                 exit(EXIT_FAILURE);
            }
            FILE *f1=fopen(F.getFile(),"r");
            if( f1 == NULL)
            {
                printf("Error opening '%s' file\n", F.getFile());
                 exit(EXIT_FAILURE);
            }
            FILE *f2=fopen(mFile,"r");
            if( f2 == NULL)
            {
                printf("Error opening '%s' file\n", mfile);
                 exit(EXIT_FAILURE);
            }

            char s[100];

            while (fgets(s,100,f1))
                fprintf(f,"%s",s);       //here it stops

            fclose(f1);

            fprintf(f,"%s","\n");

            while (fgets(s,100,f2))
                fprintf(f,"%s",s);

            fclose(f2);
            fclose(f);
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe the hard drive is failing?

Or full.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only thing I see that might cause the problem is if fopen on line 10 failed. You might put in checks after lines 10, 11 and 12 to make sure the files are opened successfully.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

do you have the original install dvd disks? If you do then you can try booting from it and running it's Repiar program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

repost current code please.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you still using line 8? If you are then it isn't allocating enough memory to hold the filename plus string's null terminating byte. Otherwise the only other thing I can suggest is for you to learn how to use your compiler's debugger and single-step through all the lines of that function to find out what it's doing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 8 and 9 are unnecessary. Just write line 11 like this
FILE *f=fopen("aux.txt","w");

line 12: What is variable F?

line 13: What is mfile?

line 17: Don't use feof(). and fseek() is not needed either. Also the parameters are incorrect order for fprintf()

  while (fgets(s,100,f2) )
  {
      fprintf(f,"%s",s);
  }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In sprintf(), the "%.5f" says to print a double (that's what the 'f' means) with 5 digits following the decimal point. So if you only want 2 digits then just change the 5 to a 2.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how many digits after the decimal point do you want? You can use sprintf() to do it. See this article

double n = 1.234678901234567890;
char str[10];
sprintf(str,"%.5f", n);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My guess is that you shouldn't use delete to deallocate the string's memory which was allocated with strdup (which is not a standard function, btw)

You are correct -- strdup() calls malloc(), not new so the string must call free() not delete[] to free it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think what you are missing is that you need a cross compiler. You can't use your masm assembler which was written for MS-DOS operating system to compile your own operating system because masm will expect you to use MS-DOS interrupts. Since you are writing your own os then you also need to implement your own hardware interrupts for the hardware you want to support. Just pretend MS-Wihdows and MS-DOS do not exist when you work on your program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't need web server software unless you want to use a browser to connect to the database. If you write your own program such as with C/C++, C#, VB.NET, etc all the program needs is the ip address of the computer that hosts the database server. If however you are writing a browser-based program then the hosting computer may need a web server program such as wamp (which includes mysql, apache2 and php).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why is mName char* instead of std::string? IMO c++ programs shouldn't use char* unless there is a good reason for it. If you used std::string then you won't need a destructor.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe for thread safety? By "kernel" do you mean your own operating system?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

is it going to be displayed on a browser? If not then just use VB.NET's built-in grid control. In any event. read the chapter about databases in that tutorial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I love this free tutorial PDF. It contains a chapter on how to use SQL databaases. I have no clue why you are doing all that HTML stuff.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If a boolean return type function contains too many returns in it, does it cause any problem

No -- The acual value of true and false is not defined, nor is it guarenteed to be either 0 or 1. It's actual value depends on the compiler -- 128 may be the correct value for your compiler. In Microsoft Visual C++ 6 and newer versions sizeof(bool) is one byte. The max value of a signed char is 127, so the value of unsigned char of 128 could be -1 in signed char. Apparently your compiler treates true as -1 and false as 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your problem is on line 16 -- you are tring to output the wrong prompt variable. Just delete line 14 and change line 16 to output Prompt (capital 'P').

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 8 is nonsense -- no one in his/her right mind would do such a thing. Useless statement.

line 7 might be a problem without typecase.
p = (char*)arr;

line 9 will NOT print the value of arr[0] as you might expect. p is a char pointer, so *p will return only the first byte of an integer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
        Dim sqlquery As String = "INSERT INTO one(regno,rollno,nepali,com_english_w,com_english_o,com_math,social_w,social_o," & _
           "science_w,science_o,hpe_w,hpe_o,creative,health,extra_math,extra_eng_w,extra_eng_o) values('" & row1 & "','" & _
            row2 & "','" & row3 & "','" & row4 & "','" & row5 & "','" & row6 & "','" & row7 & "','" & row8 & "','" _
             & row9 & "','" & row10 & "','" & row11 & "','" & row12 & "','" & row13 & "','" & row14 & "','" & row15 & "','" & row16 & "','" & row17 & "')"

I split the line up so that I could see all of it at the same time. This compiles ok with VB.NET 2012