Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIsUserAdmin returns false when UAC is enabaled in VS2010 Pin
V K 29-Apr-12 20:46
V K 29-Apr-12 20:46 
AnswerRe: IsUserAdmin returns false when UAC is enabaled in VS2010 Pin
Jochen Arndt9-Apr-12 21:12
professionalJochen Arndt9-Apr-12 21:12 
AnswerRe: IsUserAdmin returns false when UAC is enabaled in VS2010 Pin
jkirkerx11-Apr-12 11:54
professionaljkirkerx11-Apr-12 11:54 
Questionhow to achieve the effect like vmware?? Pin
Jing_K9-Apr-12 19:21
Jing_K9-Apr-12 19:21 
AnswerRe: how to achieve the effect like vmware?? Pin
Richard MacCutchan9-Apr-12 21:07
mveRichard MacCutchan9-Apr-12 21:07 
GeneralRe: how to achieve the effect like vmware?? Pin
ThatsAlok10-Apr-12 22:24
ThatsAlok10-Apr-12 22:24 
GeneralRe: how to achieve the effect like vmware?? Pin
Richard MacCutchan11-Apr-12 0:01
mveRichard MacCutchan11-Apr-12 0:01 
Questionsyntax errors? Pin
connect2janu9-Apr-12 13:46
connect2janu9-Apr-12 13:46 
q1: C programme that accepts valid file names as command line arguments and for each of the arguments, prints the type of the file (regular file, directory file, character special file, block special file,
symbolic link, etc)


#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

int main(int argc,char *argv[])
{
int i;
struct stat buf;

for(i=1;i<argc;i++)
{
printf("%s",argv[i]);
if(lstat(argv[i],&buf)==-1)
{
printf(" Lstat error\n");
continue;
}
if(S_ISREG(buf.st_mode))
printf(" Regular file\n");
if(S_ISDIR(buf.st_mode))
printf(" Directory file\n");

if(S_ISCHR(buf.st_mode))
printf(" Character file\n");
if(S_ISBLK(buf.st_mode))
printf(" Block file\n");
if(S_ISLNK(buf.st_mode))
printf(" Symbolic link file\n");
}
}
/////////////////////////////////////////////////////
q2: C programme to do the following: Using fork() create a child process. The child process prints its own process id and id of its parent and then exits. The parent waits for the childto finish(by executing wait()) and prints its own process id and the id of its child and then exits.


#include <stdio.h>
#include<stdlib.h>
#include<sys/stat.h>
#include<sys/types.h>


int main()
{
pid_t ppid,mpid,pid,status=0;
pid=fork();
if(pid<0)
{
printf("Error");
exit(0);
}

if(pid==0)
{
mpid=getpid();
printf("\n I am child, my id is %d",mpid);
ppid=getppid();
printf("\n I am parent, my id is %d ",ppid);
exit(1);
}

pid=waitpid(pid,&status,0);
mpid=getpid();
printf("\n I am parent with id %d and my child is %d \n",mpid,pid);
}

both giving sysntax error,where is the mistake,can any rectify it,i have tried[in fedora 12-linux] i couldnt got solution
AnswerRe: syntax errors? Pin
David Crow9-Apr-12 17:22
David Crow9-Apr-12 17:22 
AnswerRe: syntax errors? Pin
Malli_S9-Apr-12 18:47
Malli_S9-Apr-12 18:47 
QuestionThe questions we get these days! PinPopular
Erudite_Eric9-Apr-12 6:45
Erudite_Eric9-Apr-12 6:45 
AnswerRe: The questions we get these days! Pin
Chuck O'Toole9-Apr-12 7:59
Chuck O'Toole9-Apr-12 7:59 
GeneralRe: The questions we get these days! Pin
Richard MacCutchan9-Apr-12 8:05
mveRichard MacCutchan9-Apr-12 8:05 
AnswerRe: The questions we get these days! Pin
Chuck O'Toole9-Apr-12 8:10
Chuck O'Toole9-Apr-12 8:10 
GeneralRe: The questions we get these days! Pin
PJ Arends9-Apr-12 9:44
professionalPJ Arends9-Apr-12 9:44 
GeneralRe: The questions we get these days! Pin
jeron110-Apr-12 4:02
jeron110-Apr-12 4:02 
GeneralRe: The questions we get these days! Pin
Arthur F Souza10-Apr-12 9:12
Arthur F Souza10-Apr-12 9:12 
GeneralRe: The questions we get these days! Pin
David Crow10-Apr-12 9:28
David Crow10-Apr-12 9:28 
GeneralRe: The questions we get these days! Pin
Arthur F Souza10-Apr-12 9:31
Arthur F Souza10-Apr-12 9:31 
GeneralRe: The questions we get these days! Pin
Richard Jones10-Apr-12 2:38
Richard Jones10-Apr-12 2:38 
GeneralRe: The questions we get these days! Pin
KP Lee10-Apr-12 12:35
KP Lee10-Apr-12 12:35 
GeneralRe: The questions we get these days! Pin
Dominic Amann12-Apr-12 7:52
Dominic Amann12-Apr-12 7:52 
AnswerRe: The questions we get these days! PinPopular
jschell9-Apr-12 11:15
jschell9-Apr-12 11:15 
AnswerRe: The questions we get these days! Pin
Chuck O'Toole9-Apr-12 12:19
Chuck O'Toole9-Apr-12 12:19 
GeneralRe: The questions we get these days! Pin
Wes Aday9-Apr-12 13:35
professionalWes Aday9-Apr-12 13:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.