Click here to Skip to main content
15,916,835 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Saving a list box or list control data to txt file Pin
RobJones4-Apr-05 5:44
RobJones4-Apr-05 5:44 
GeneralRe: Saving a list box or list control data to txt file Pin
shinyhui4-Apr-05 14:17
shinyhui4-Apr-05 14:17 
GeneralTELNET FAILURE!!! URGENT HELP NEEDED!!! Pin
URagavSouth3-Apr-05 23:32
URagavSouth3-Apr-05 23:32 
Generalvalidation Pin
mpapeo3-Apr-05 23:14
mpapeo3-Apr-05 23:14 
GeneralRe: validation Pin
Gary R. Wheeler4-Apr-05 1:57
Gary R. Wheeler4-Apr-05 1:57 
GeneralRe: validation Pin
David Crow4-Apr-05 2:55
David Crow4-Apr-05 2:55 
GeneralRe: validation Pin
mpapeo4-Apr-05 7:51
mpapeo4-Apr-05 7:51 
GeneralRe: validation Pin
mpapeo4-Apr-05 10:30
mpapeo4-Apr-05 10:30 
I tried using something different but now i am getting these errors, how can i solve them
<br />
#include <stdio.h><br />
#define _WIN32_WINNT 0x0400<br />
#define WINVER 0x0400<br />
#include <windows.h><br />
#include <stdio.h><br />
#include <windef.h><br />
#include <winbase.h><br />
#include <imagehlp.h><br />
#include <stdlib.h><br />
#include <ctype.h><br />
typedef struct _iobuf FILE;<br />
#include <assert.h><br />
#include <sys/types.h><br />
#include <sys/stat.h><br />
int menu(void)<br />
{<br />
int choice;<br />
char iobuf[80];<br />
int i,len,valid;<br />
boolean isDigit();<br />
printf ("\n");<br />
printf ("*****************************************\n");<br />
printf ("*\t\t\t\t\t*\n*\tPROCESS CREATION \t\t*\n");<br />
printf ("=========================================");<br />
printf ("\n=\t 1: Create a process \t\t=");<br />
printf ("\n=\t 2: Suspend the process\t\t=");<br />
printf ("\n=\t 3: Resume process \t=");<br />
printf ("\n=\t 4: Shutdown the process \t=");<br />
printf ("\n=========================================\n");<br />
printf ("\n");<br />
<br />
printf("\nEnter choice (1-4): ");<br />
<br />
  valid = 0;<br />
  while( valid == 0)<br />
  {<br />
    fgets(iobuf,sizeof(iobuf),stdin);<br />
    // remove '\n' <br />
    len = strlen(iobuf)-1;<br />
    iobuf[len] = 0;<br />
    // validate data<br />
    valid = 1; // assumed valid input<br />
    for(i = 0; i < len; i++)<br />
    {<br />
        if( !isdigit(iobuf))<br />
        {<br />
          printf("Plese enter numeric digits only\n");<br />
          valid = 0;<br />
          break;<br />
        }<br />
     }<br />
  }<br />
  choice = atoi(iobuf);<br />
<br />
<br />
scanf("%d", &choice);<br />
return choice; <br />
}<br />
int main(int argc, char **argv) <br />
{<br />
	PROCESS_INFORMATION pi;       /* filled in by CreateProcess */<br />
	STARTUPINFO si;               /* startup info for the new process*/<br />
	HANDLE hProcess;<br />
	DWORD lpAddr = 0;<br />
	TCHAR lpApplicationName[_MAX_PATH]="";	<br />
	int result;<br />
char ans [4]="";<br />
int choice;<br />
<br />
<br />
while((choice = menu())!=5)<br />
{<br />
switch (choice)<br />
{<br />
case 1: <br />
<br />
	GetStartupInfo(&si);<br />
lpAddr = 0;<br />
	ZeroMemory( &si, sizeof(si) );<br />
	si.cb = sizeof(si);<br />
	ZeroMemory( &pi, sizeof(pi) );<br />
printf("Enter process you want to execute: ",lpApplicationName);<br />
scanf ("%s",lpApplicationName);<br />
printf("Process %d reporting for creation\n",GetCurrentProcessId());//print out our process ID<br />
<br />
CreateProcess(NULL, /* lpApplicationName */<br />
lpApplicationName, /* lpCommandLine assumes to use curent process directory*/<br />
NULL, /* lpsaProcess */<br />
NULL, /* lpsaThread */<br />
FALSE, /* bInheritHandles */<br />
CREATE_NEW_CONSOLE, /* dwCreationFlags */<br />
NULL, /* lpEnvironment */<br />
NULL, /* lpCurDir */<br />
&si, /* lpStartupInfo */<br />
&pi /* lpProcInfo */<br />
); <br />
hProcess = pi.hProcess;<br />
printf("New Process ID: %d ",pi.dwProcessId);<br />
printf("has started \n"); <br />
break;<br />
case 2:<br />
		SuspendThread(pi.hThread);// identifies thread to suspend	<br />
break;<br />
case 3:<br />
	ResumeThread(pi.hProcess);		<br />
break;<br />
case 4:<br />
printf("\nYou are about to terminate a running process, do you want to continue ( y or n) ");<br />
scanf ("%s",ans);<br />
result = strcmp(ans,"y");<br />
if (result==0)<br />
{<br />
TerminateProcess(pi.hProcess, 0);//identifies the process to terminate<br />
					GetLastError();<br />
}<br />
	break;<br />
default:<br />
printf("\nInvalid choice: ");<br />
}<br />
}<br />
return (0);<br />
}<br />
<br />
C:\Documents and Settings\9804626\Desktop\pro.c(46) : error C2107: illegal index, indirection not allowed<br />
C:\Documents and Settings\9804626\Desktop\pro.c(46) : error C2296: '&' : illegal, left operand has type 'unsigned short *'<br />
Error executing cl.exe.<br />


-oam-
GeneralRe: validation Pin
David Crow4-Apr-05 10:38
David Crow4-Apr-05 10:38 
GeneralRe: validation Pin
mpapeo4-Apr-05 11:01
mpapeo4-Apr-05 11:01 
GeneralRe: validation Pin
mpapeo4-Apr-05 12:01
mpapeo4-Apr-05 12:01 
GeneralRe: validation Pin
David Crow4-Apr-05 17:03
David Crow4-Apr-05 17:03 
GeneralRe: validation Pin
David Crow4-Apr-05 17:01
David Crow4-Apr-05 17:01 
Generalglobal variables in dynamic link library Pin
arthi_mclt3-Apr-05 23:05
arthi_mclt3-Apr-05 23:05 
GeneralRe: global variables in dynamic link library Pin
Alexander M.,4-Apr-05 2:53
Alexander M.,4-Apr-05 2:53 
GeneralText display with CHtmlView Pin
lordguid3-Apr-05 22:48
lordguid3-Apr-05 22:48 
GeneralRichEdit and Console Pin
AdyOS3-Apr-05 22:36
AdyOS3-Apr-05 22:36 
GeneralRe: RichEdit and Console Pin
toxcct3-Apr-05 22:39
toxcct3-Apr-05 22:39 
GeneralRe: RichEdit and Console Pin
AdyOS3-Apr-05 23:00
AdyOS3-Apr-05 23:00 
GeneralRe: RichEdit and Console Pin
toxcct3-Apr-05 23:22
toxcct3-Apr-05 23:22 
GeneralRe: RichEdit and Console Pin
S. Senthil Kumar3-Apr-05 23:24
S. Senthil Kumar3-Apr-05 23:24 
GeneralRe: RichEdit and Console Pin
AdyOS3-Apr-05 23:33
AdyOS3-Apr-05 23:33 
GeneralRe: RichEdit and Console Pin
AdyOS3-Apr-05 23:58
AdyOS3-Apr-05 23:58 
GeneralVxDs vs DLL Pin
Neha.marwaha3-Apr-05 22:25
Neha.marwaha3-Apr-05 22:25 
GeneralRe: VxDs vs DLL Pin
toxcct3-Apr-05 22:36
toxcct3-Apr-05 22:36 

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.