16,007,443 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by sanathbt (Top 5 by date)
sanathbt
3-Oct-11 7:18am
View
Now I am reading the system time by using time.h . I want to subtract 5 minutes from that time...
sanathbt
30-Sep-11 7:42am
View
I am not getting the remaining logic only... I tried my logic its giving -ve values for some input.
If you know the logic, give me suggestion.... That logic to work for everything like leap year etc....
sanathbt
30-Sep-11 7:27am
View
is this for c++? If yes tell me which header i have to use...
sanathbt
26-Sep-11 8:35am
View
the create thread will execute the function in different thread in the same process. How i want is that the function has to be execute in the background in different process. Me attaching the code below.
In this program, the add() function will run in background process, after the completion of the whole function, the background process will be closed but the original process remains as it is... How to delete that process...
#include "stdafx.h"
#include <time.h>
#include <iostream>
#include <windows.h>
#include <stdlib.h>
using namespace std;
DWORD WINAPI add( LPVOID lpParameter)
{
int a,b,c;
cout<<"a:";
cin>>a;
cout<<endl;
cout<<"b:"<<endl;
cin>>b;
c=a+b;
cout<<"sum(c)="<<c<<endl;
return 0;
}
void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait){}
}
int main ()
{
DWORD dwThreadID;
int n,frequency;
HANDLE hProcess;
PROCESS_INFORMATION processInformation;
STARTUPINFO startupInfo;
cout<<"enter the frequency:";
cin>>frequency;
CreateProcess(TEXT("sameprocess.exe"), NULL, NULL, NULL, FALSE, HIGH_PRIORITY_CLASS|CREATE_NEW_CONSOLE, NULL, NULL, &startupInfo, &processInformation);
for(int i=0;i<2;i++)
{
HANDLE hThread = CreateThread(0,0,add,0,0,&dwThreadID);
cout<<"hi hello";
wait (frequency);
}
printf ("FIRE!!!\n");
//WaitForSingleObject( processInformation.hProcess, INFINITE );
CloseHandle( processInformation.hProcess );
CloseHandle( processInformation.hThread );
return 0;
}
And my program is not waiting for the user input , give me a solution for this..
sanathbt
19-Sep-11 8:59am
View
Ya exactly..