|
Thanks for help.It's working
|
|
|
|
|
Hi all,
PLease tell me how can i get Total days of a Year.(wheter 365 or 366)
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
If the year is a multiple of 4, it's a leap year, i.e. there are 366 days.
Exception #1:
If the year is dividable by 100 it's not a leap year.
Exception #2:
If the year is dividable by 400 it's a leap year anyway.
Hint: use the modulus operator.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Wow, I didn't know about exception #2, I always thought scientists decide after a few centuries whether this century year will be a leap year or not.
Thanks.
It's better to know some of the questions than all of the answers.
Pravin.
|
|
|
|
|
You could use COleDateTime() or COleDateTimeSpan()
|
|
|
|
|
|
bool isLeapYear(int year )
{
return year % 400 ? year % 100 ? year % 4 ? false : true : false : true;
}
There should be a forum for really cool code snippets like this! Nicely done Carlo!
|
|
|
|
|
Michael Schubert wrote: There should be a forum for really cool code snippets like this! Nicely done Carlo!
Quote Selected Text
No worries!! We have the magic site of carlo..
Regards,
Sandip.
|
|
|
|
|
|
On a serious note, I completely agree with you. We need a "Cool Code" forum.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Yes I agree with you
May be you can add a suggestion in the suggestion forum..
Regards,
Sandip.
|
|
|
|
|
|
Michael Schubert wrote: There should be a forum for really cool code snippets like this!
There is an entire website for this. Haven't you seen:
http://www.cpallini.freeproductz.com[^]
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
URLz iz givez me errorz. plz helpzz.. urgentzzzz!! wherez da codez???
|
|
|
|
|
How to scan or identify a physical damage (like scratch or spot) in a blank writable CD?
Thanks
|
|
|
|
|
NS17 wrote: How to identify a physical damage (like scratch or spot) in a blank writable CD?
You will need a small cotton ball, a mild liquid soap, clean water and a table lamp.
Add a few drops of the liquid soap in water, soak the cotton in the soapy solution and wipe the surface of the disc gently, rubbing the cotton back and forth against it in a rocking motion.
Switch on the table lamp and let the light lit the surface of the CD. You will be able to spot scratches and physical damages on it easily now.
BTW, this forum is for Visual C++ questions.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
bro your a comedian.
he wants to know how to check for physical damage when the cdrom is reading the cd.. software-wise i think
search for
damaged sectors checking source code
doubt u'll find any.. but there must be a way to check it. how do CDR programs know the CD is blank when you enter it.. oh thats easy.. check the size of the cd.. but when its already full.. I guess you have to check every byte.. written to CD and see if it is changed? if it is.. then return damaged.
|
|
|
|
|
Cbadboy wrote: I guess you have to check every byte.. written to CD and see if it is changed? if it is.. then return damaged.
It is changed or it is unreadable? If thought if the data could not be read, then he must return damaged. That's kinda obvious, I thought. Therefore my funny reply to him.
But however, I think that one cannot be very much sure about if the read failed due to a physical damage or not.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
I just only need to know damaged area's position (sector, or something else)... CD can be blank or not, but the damage will not be in the written area. If it was in the written area then error will occur in the normal reading, right? Since it will not be so, I think I need to find another method.
|
|
|
|
|
Rajesh R Subramanian wrote: BTW, this forum is for Visual C++ questions.
So just retool your cotton ball/soap/water/lamp example in the form of code.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I need to create a directory under c:\Users\Public. My os is Vista. I am using VC++. I cannot use latest SDK. Can I know to to get to that path programmatically using VC++6.0
Thanks....
|
|
|
|
|
To create a folder use CreateDirectory
To change working folder use SetCurrentDirectory
|
|
|
|
|
Thanks.. But I cannot manually mention the directory path. I would like to know any macro which maps to that directory path.
|
|
|
|
|
MyView wrote: But I cannot manually mention the directory path.
Do you mean that you cannot hard code that path? Can you please clarify?
|
|
|
|