|
I can't really tell from your question but you appear to be trying to find out:
- whether C stdio (FILE *) still exists. It does and works just as well as it always did. Please note that DOS FCBs were nothing to do with C's stdio library although ancient C compilers may have used them internally.
- whether the low level BIOS wrapper interface from 16 bit versions of C still exists. The answer to that one is that even if it does you won't be able to call it from a Windows app as Windows has a habit of killing apps that try using the BIOS to write to things they shouldn't.
You don't need to issue interrupts to get system services in Windows. Interrupts were just a way of providing a small (but complex) interface to the operating system. These days the userland libraries in your OS do that for you. In Windows they're NTDLL, GDI and KERNEL. Just call the functions and don't worry about the underlying details.
There are ways of monitoring file behaviour - security software does it all the time. You have to write a file system filter driver to do this though. If you do a Google search you'll find loads of confusing information to sift through.
Cheers,
Ash
|
|
|
|
|
Voila. That's a punch. Thank you.
Let me try those.
meanwhile... if people finding this thread and would like to drop some notes then please do so... so guys like me will get some useful info from that.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Hello everybody !
Now ,I want to convert the vc project to vs2008.
when I complied this dll in vs2008:
it throw this error code :
1>c:\program files\microsoft sdks\windows\v6.0a\include\sdkddkver.h(217) :
fatal error C1189: #error : _WIN32_WINNT settings conflicts with _WIN32_IE setting
I search the macro "_WIN32_WINNT" in my project,but it isn't found defined this anywhere.
Now I add this code in the "stdafx.h":
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
At last, I delete the new SDK Include path in the vs2008.
but it failed too.
Why doesn't this error produced ,and how to solve it ??
Thans for you reply !
Best Wish for you !
|
|
|
|
|
Looks like the compiler is mixing up files coming from different SDK versions.
WINVER _WIN32_WINNT and _WIN32_IE should be defined so that the "components" are not newer than the API they run on.
Just give a look to the order of the directory search (include, libraries, DLL etc. should refer to the various SDKs in the same order).
Also, check if no ".h" file is missing in a new SDK (so that an older one is found in another)
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Yes ,you're right !
I install this version:
A、Microsoft Visual C++ 6.0
B、Visual Studio 2008
C、Microsoft Platform SDK for Windows Server 2003 R2
D、Microsoft Windows SDK v6.0A
So I try to uninstall the 'C' and 'D', and then to compiled it .
Thanks !
Best wish to you ,and your family !
|
|
|
|
|
I mean correct _WIN32_WINNT and _WIN32_IE on stdafx.h or define your header file.
On stdafx.h, You can see these definitions.
Code Snippet
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600
#endif
Bolded value can be modified.
So you shoud change value .
It's up to your target machine's OS or API functions.
|
|
|
|
|
Hi sir,
I want the difference between two dates.
Suppose if the previous date is 11-07-2010 (in this format.)
I need to find the current date.
and also the difference between them.
Current Date - previous date.
how can i do this.
Thanks
Raj
|
|
|
|
|
You can use a COleDateTime[^] class for that purpose (by using the + and - operators).
|
|
|
|
|
Hi sir,
Suppose if i have one date in 12:7:2010(Current Date)
and other in 12-06-2010(P Date)
How can i find difference between them(P Date - Current Date)
Thanks
Raj
|
|
|
|
|
Why do you ask your question again ? Did you follow the link I provided and tried to understand the concept ?
|
|
|
|
|
I recommend you do not reinvent this. There are ATL classes you could use COleDateTime and COleDateTimeSpan. There are probably lots of other free classes as well.
|
|
|
|
|
The boost date_time library works pretty well if you don't want to use the MFC/ATL /WTL stuff that the previous posters have mentioned.
Another option is to use the humble time_t, remembering to convert between number of days and number of seconds. This is especially handy if you work with luddites that squeal about anything boost like.
Cheers,
Ash
|
|
|
|
|
chk it
COleDateTime prev_date;
CTime curr_time = CTime::GetCurrentTime();
CString curr_date_str;
curr_date_str=curr_time.Format(_T("%d-%m-%Y"));
COleDateTime curr_date;
curr_date.ParseDateTime(curr_date_str,0,LANG_USER_DEFAULT);
COleDateTimeSpan diff=(curr_date-prev_date);
|
|
|
|
|
Hi sir,
I tried with your code.
prev_date = "11-07-2010";
test2 = "13-07-2010";
COleDateTimeSpan diff=(test2-prev_date);
The diff is showing as null.
Thanks
Raj
|
|
|
|
|
CString str;
COleDateTime prev_date;
str="11-07-2010";
prev_date.ParseDateTime(str,0,LANG_USER_DEFAULT);
str=prev_date.Format("%d-%m-%Y");
prev_date.ParseDateTime(str,0,LANG_USER_DEFAULT);
AfxMessageBox(prev_date.Format("%d-%m-%Y"));
CTime curr_time = CTime::GetCurrentTime();
CString curr_date_str;
curr_date_str=curr_time.Format(_T("%d-%m-%Y"));
COleDateTime curr_date;
curr_date.ParseDateTime(curr_date_str,0,LANG_USER_DEFAULT);
AfxMessageBox(curr_date.Format("%d-%m-%Y"));
COleDateTimeSpan diff=(prev_date-curr_date);
int noofday=0;
noofday=(int)diff.GetTotalDays();
if(noofday<=0)
{
noofday=-(noofday);
}
CString days_str="";
days_str.Format("%d",noofday);
|
|
|
|
|
Hi!
i use localtime function to get current time, in "tm struct".
how do i get a new "tm struct" that adds the specified number of days to the value of this instance.
this is similar with DateTime::AddDays, but i don't use any MFC Class.
time_t t;
struct tm * tt;
char buffer[50];
time(&t);
tt = localtime(&t);
int dayOfWeek = tt->tm_wday;
tt->tm_mday -= dayOfWeek;
in this code there is a bug.
if tt->tm_mday < dayOfWeek then ???
please help me.
Zo.Naderi-Iran
|
|
|
|
|
Why don't you add the proper number of seconds (1 day is 86400 secs) directly to the time_t variable?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
oh, ok.
thanks a lot, dear CPallini.
Zo.Naderi-Iran
|
|
|
|
|
Another answer is
To get system date:
COleDateTime curDateTime;
curDateTime = COleDateTime::GetCurrentTime();
COleDateTimeSpan represents a relative time, a time span.
COleDateTimeSpan daySpan(25,0,0,0);
25 represents 25 days span. Next three zeros – hours, minutes, and seconds.
Wanna get the date, 25 days from current date, add daySpan with curDateTime:
COleDateTime comDateTime;
comDateTime = curDateTime + daySpan;
Also see CTime and CTimeSpan
|
|
|
|
|
this is the sourse code............ and i don know what to do next....
could anyone plz check if this sourse code is right and plz help
me to finish full baccarat program?
i am always tryin and tryin but c is hard...
#include <stdio.h>
#include <stdlib.h>
int drawCard();
int get2cards(int who);
void get3rdCard(int who, int *p_total);
main() {
int playerTotal; BankerTotal;
srand(time(NULL));
playerTotal = get2cards(1);
BankerTotal = get2cards(2);
if (playerTotal < 6)
get3rdCard(1, &playerTotal);
}
int drawCard() {
int value;
value = rand() %13 + 1;
return value;
}
int get2cards(int who) {
int total;
total = drawCard();
total += drawCard();
return total;
}
void get3rdCard(int who, int *p_total) {
int card3;
card3 = drawCard();
}
o.... and the output.... has to be like this...
plz help me.. thank you very much
PLAY BACCARAT Enter bet winner (1-Player/ 2-Banker): 0
Invalid - must choose winner as 1-player or 2-Banker: 3
Invalid - must choose winner as 1-player or 2-Banker: 2
Enter bet amount (2-20): 21
Invalid - bet must be between 2 and 20: 1
Invalid - bet must be between 2 and 20: 10 Player Cards: 7 8
Player total: 5 Banker Cards: 4 Queen
Banker total: 4 Player draws again: a(n) 10 to get total of 5
Player wins
Your bet lost!
|
|
|
|
|
kcta5597 wrote: but c is hard...
That's why you're taking a class, to learn more about it and make it easy!
I won't help directly (otherwise, how do you learn), but I will give a few tips:
1/Read the "how to ask a question" post at the top of this forum. It's there for YOUR own safety and convenience. Annoying people with badly formatted questions lowers your chances of being helped.
2/ Break your problem into manageable bits.
3/ Break your problem into manageable bits.
I know I said it twice, but it's the most important programming lesson you will ever learn.
The first bit of your assignment is to print a question. Look over your previous classwork and find out how to do that.
Next, get the answer from the user.
Then, validate the answer.
If the user puts in silly answers, tell them they're an idiot and loop back.
int nPlayingAs = 0;
...
while (nPlayingAs != PLAYER && nPlayingAs != BANKER)
{
...
...
}
Notice I write PLAYER , not 1 . Get in practise for later. It's over the top for this assignment, but your future self will thank you later.
Do the same with the bet number...
How you draw the cards is up to you.
You could have a random number from 0-51. Or, two random numbers: 0-3, and 0-12. This was you can say "4 of hearts", not just "4".
Make sure to keep track of cards you've already drawn. You don't want the user to think you're pulling the same card again, do you?
I wish you luck with your assignment,
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
I would do 0-51 over 0-3/0-12. It will make it simpler to get a normal distribution once a card has been drawn from the deck.
|
|
|
|
|
Well, since there is a direct mapping, that's really matter of personal taste.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
But of course. I personally find 'easy' tasteful
|
|
|
|
|
I'd do 0-51 also, but the OP might not have learned % operator yet...
I was trying to think back to the cobwebs of time when I was learning this stuff.
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|