Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6987289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:55:03+00:00 2026-05-27T18:55:03+00:00

I’m using Visual Studio 2008 Express, and I have this logging code: fprintf(fp,%s %s

  • 0

I’m using Visual Studio 2008 Express, and I have this logging code:

fprintf(fp,"%s %s %s %s %d %s\n", pType, __DATE__, __TIME__, pFileName, lineNo, pMsg.c_str());
fflush(fp);

Sometimes, if I don’t delete the log and just keep appending to it, the __TIME__ macro just keeps printing the old time, rather than the current time.

I’m using the following code to open the file

if(pfileName != NULL)
{
    fp = fopen(pfileName, "a+");
    if(fp != NULL)
        fseek(fp, 0, SEEK_END);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:55:04+00:00Added an answer on May 27, 2026 at 6:55 pm

    The problem is you’re not doing a rebuild.

    By default, Visual Studio only builds/compiles the source files that have changed (been modified) since the last time you have compiled your project. This is intended to save time, and it’s a very useful feature. If you want to ensure that source files are recompiled, regardless of whether or not they’ve been changed since the last build, you have to instruct VS to rebuild your code (or go through the song and dance of doing a clean, and then a build on your project).

    The reason why that matters is that the __TIME__ preprocessor macro is expanded during preprocessing (which happens right before compilation, at least for our purposes here) with the current time. It got expanded the first time you compiled the code, and never gets changed unless you modify the source file or recompile (rebuild) it.

    This is probably not what you’re looking for in a logging function. Instead of the compilation time, you want to print the current system time. You can use the time function to obtain that—to use it, make sure that you include <time.h> at the top of your source file. Or alternatively, if you’re already including <windows.h>, you can call the GetSystemTime function to fill a SYSTEMTIME structure that gives you the current time and date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.