LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-07-2008, 04:56 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 141

Rep: Reputation: 15
pls convert this windows code into linux code


Here we have enum structure with CleanType name.
This CleanType enum structure is initialiased in _ThrdHandle.(windows thread handle) and created object "ThrdHandle" to this thread handle "_ThrdHandle".

In thread function *DelFolderThrd ,created the obj of type ThrdHandle for the arg *element and assigned element to CleanType enum.
This *DelFolderThrd is created in CleanupOlderFiles().


enum CleanType{
NOCLEAN, FREPORTS, FDRILLDROWNS, PREPORTS
};
typedef struct _ThrdHandle
{
CleanType cType;
}ThrdHandle;

void *DelFolderThrd(void* element)
{
CleanType clnType = NOCLEAN;
ThrdHandle * handler = (ThrdHandle*)element;
if(element)
clnType = handler->cType;
}
void CleanupOlderFiles(bool bFirstTime = false)
{
unsigned delFDrillthreadId;
ThrdHandle * stFDrillmsg = new ThrdHandle;
memset(stFDrillmsg, 0, sizeof(ThrdHandle));
stFDrillmsg->cType = FDRILLDROWNS;
stFDrillmsg->hThread =(HANDLE) _beginthreadex(NULL, 0,&DelFolderThrd, stFDrillmsg, 0, &delFDrillthreadId);
}

Please convert this windows code into linux.

Thankq,
NAG.

Last edited by nagendrar; 05-07-2008 at 10:07 AM. Reason: explaining the code
 
Old 05-07-2008, 05:12 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,462
Blog Entries: 54

Rep: Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899
Hello and welcome to LQ. Work or homework, if you need to convert something you do that yourself. You are free to ask specific questions, but telling the LQ community to do this for you without properly introducing yourself and without even trying to explain what and why you need it is not how we like to see things here. I suggest you edit your post and try a more respectful approach.
 
Old 05-07-2008, 07:11 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
I am not a programmer, but I'll bet that the conversion goes something like this:

1. Set up a Linux development environment with all the appropriate headers and libraries.
2. Copy and paste the code
3. Compile and debug as required

When posting homework questions, it's always better to tell us what the class is, and what you have already learned.
 
Old 05-07-2008, 09:53 AM   #4
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Rep: Reputation: 16
nothing easier than that . seriously, it is impossible just to convert code by looking at a snippet. copying the source won't do either because if the code does have windows api system calls you need to translate them into proper POSIX (i.e. linux system calls). we can't do your work for you, buddy, we might assist but you have to figure it out for your self.

btw: what do you need it for?

vadkutya
 
Old 05-08-2008, 01:37 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,986
Blog Entries: 11

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 06-03-2008, 06:42 AM   #6
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by vadkutya View Post
nothing easier than that . seriously, it is impossible just to convert code by looking at a snippet. copying the source won't do either because if the code does have windows api system calls you need to translate them into proper POSIX (i.e. linux system calls). we can't do your work for you, buddy, we might assist but you have to figure it out for your self.

btw: what do you need it for?

vadkutya

enum CleanType{
NOCLEAN, FREPORTS, FDRILLDROWNS, PREPORTS
};
typedef struct _ThrdHandle
{
CleanType cType;
}ThrdHandle;

void *DelFolderThrd(void* element)
{
CleanType clnType = NOCLEAN;
ThrdHandle * handler = (ThrdHandle*)element;
if(element)
clnType = handler->cType;
}
void CleanupOlderFiles(bool bFirstTime = false)
{
unsigned delFDrillthreadId;
ThrdHandle * stmsg = new ThrdHandle;
memset(stmsg,0, sizeof(ThrdHandle));
pthread_t hThread;
stmsg->cType = FDRILLDOWNS;
pthread_create(&hThread,NULL,DelFolderThrd,(void *)stmsg);
}
 
Old 06-03-2008, 07:00 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
nagendrar;

Why are you here?

All of your posts look like homework---and now you are posting a reply that makes no sense......
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM
convert a qt designer code in linux to run in windows shaj4848 LinuxQuestions.org Member Success Stories 0 07-27-2005 01:29 AM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM
Convert a dll code to linux EvilLinux Programming 5 12-08-2004 09:51 AM


All times are GMT -5. The time now is 12:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration