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

Do not check if (f==NULL) after FILE *f=fopen(filename,"w").

Wrong conclusion. You can't use file name aux because aux is a reserved system name, as previously mentioned by Nathan.

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

I just tried it using VC++ 2012 on Windows 8. This is what happened:

File name either "aux.txt" or "aux" (no extension). Neither file name was created, but fopen() succeeded and no errors writing to the file.

#include <stdio.h>
#pragma warning(disable: 4996)

int _tmain(int argc, _TCHAR* argv[])
{
    FILE* fp = fopen("aux.txt","w");
    if( fp == NULL)
    {
        printf("Error\n");
        return 1;
    }
    fprintf(fp,"Hello World\n");
    fclose(fp);
    printf("All done\n");
    return 0;
}
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

Spend one day in a military bootcamp and you will see privacy in action -- there ain't none. Everything you do is in public display of other military members. People don't "need" privacy -- it's just an imaginary thing.

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

If the Libertarian party got control of US government it would be like that.

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

Maybe we should just run all the bills/laws that congress and the pres have passed over the past 200+ years through a paper shredder and start all over again with the basics of what is in the US Constitution.

That would mean: No social security, No Medicare, No pensions, No unemployment income, No welfare, No disability insurance, No department of defense, No Medicaid, No Health and Human services, and No spending on Transportation..

YES YES YES

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

how will the code/program know the number of days, from the date of hire, to the current date (when I'm processing payroll)?

Use functions in time.h (or ctime). You know the date of hire, so populate a struct tm with the day, month and year, zero out all other fields, then call mktime() to convert the structure to time_t variable (usually it's an unsigned int). Call time() to get the time_t value of the current date. Then all you do is call difftime() to find out the difference between the two.

Here is a simple example.

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

what is "incog mode"??

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

I would not recommend simple copy/paste/compile as suggested by others. There are many features in C# that are a lot easier to do then they are in C/C++ due mostly to .NET framework api functions. And there are many other things that are done entirely differently. You and your program will be better off taking ddanbe's original suggestion to just rewrite the program entirely in C#, and while you are at it you can easily make it a GUI Windows program instead of command-line program. GUI windows are pretty simple in C# compared to terribly complicated win32 gui c programs.

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

You might try one of these programs to uninstall MS Office. I never used them so I don't know how well they work. You should back up the registry before using any of them.

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

Download free OpenOffice, it's compatible with Microsoft Office files. As for MS Office, what verion do you have? And what version of Windows are you running?

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

Did you read the link? It doesn't contain code.

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

You don't have to write it yourself, there's already a media control. Read this article

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

Windows 8 has made such changes pretty easy. There's an option in control panel to change default programs and file extension associations.

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

There is no such thing as char='' (no spaces between the two ticks '). Put a space between the two ticks.

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

Maybe we should thank the spammers for that :) Let's all email the government lots of spam.

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

Lets pretend you attend a 12 cinima movie threater. Inside one of the 12 cinimas you will find several rows of seats, each row contains any number of seats. That is a 2d array of seats

Now you can consider the entire cinima threater as a 3d array -- the first dimension represents each of the 12 cinimas, and inside each cinima is a 2d array of seats

So if you represent all the seats liks this

int const NumberCinimas = 12;
int const NumberRows = 15;
int const NumberSeatsPerRow = 20;

int Seats[NumberCinimas][NumberRows][NumberSeatsPerRow];

To assign a seat to someone you will need to know the cinima he wants to watch, and an empty seat in the desired row. So I can buy a ticket for cinima #3, row 15, seat 4

Seats[3][15][4] = AncientDragon;

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

"we are a bunch of people who don't say LOL at work and need your money even though we have a enough."

Two thoughts:

  • If you never say LOL does that mean you are a bunch of humorless geeks? (I doubt it)
  • If you have enough money what do you need more for?
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

Well, just so you aren't trying to trick us, you post your code first then someone might post his/her code. If it's too large then just zip it up and attach it to your post.

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

Well, I've given up on this idea after reinstalling Windows 8 for the third time because I screwed up the entire hard drive. Maybe I'll just get another computer that only has Ubuntu on it.

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

Huh? How could a downvote become invalid due to changes in technology?

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

You might go over there and take him swimming with concrete shoes :)

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

The process is initially given a limited amount of memory, the operating system expands the memory space as needed. 2^32 is the max amount of memory any 32-bit program can access -- that doesn't mean the process has that much available for its own use.

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

I think there is a free 3d party start button, but it isn't exactly like that of Windows 7.

many people said windows 8 is not user friendly . is it so?

That's a matter of personal taste and education. Once you figure out where everything is then Windows 8 is ok, except for the metro screen on PCs. But that's easy to change too. You can also remove buttons you don't want on the metro screen. By default every program you install has one or more buttons on the metro screen, but you can remove them if you don't want them.