Click here to Skip to main content
15,886,798 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: External program used excel, if you click on the click of a button to send a message through the simulation, excel this call can not be started. Pin
Member 112832725-Dec-14 4:38
Member 112832725-Dec-14 4:38 
GeneralRe: External program used excel, if you click on the click of a button to send a message through the simulation, excel this call can not be started. Pin
Richard MacCutchan5-Dec-14 4:52
mveRichard MacCutchan5-Dec-14 4:52 
GeneralRe: External program used excel, if you click on the click of a button to send a message through the simulation, excel this call can not be started. Pin
Member 112832727-Dec-14 19:14
Member 112832727-Dec-14 19:14 
AnswerRe: External program used excel, if you click on the click of a button to send a message through the simulation, excel this call can not be started. Pin
Member 112832725-Dec-14 3:49
Member 112832725-Dec-14 3:49 
Questionthreads ( c language ) in Ubunt Pin
Eng \ zeyad3-Dec-14 0:05
Eng \ zeyad3-Dec-14 0:05 
AnswerRe: threads ( c language ) in Ubunt Pin
den2k883-Dec-14 0:10
professionalden2k883-Dec-14 0:10 
AnswerRe: threads ( c language ) in Ubunt Pin
CPallini3-Dec-14 0:43
mveCPallini3-Dec-14 0:43 
GeneralRe: threads ( c language ) in Ubunt Pin
Eng \ zeyad3-Dec-14 0:50
Eng \ zeyad3-Dec-14 0:50 
#include 
<stdio.h>
#include 
<stdlib.h>

// The array that holds the data
int array[1000]
;


void testSum()
{
     int sum=0;
 
  int j; 
  
  
   for(j=0 
; j< 1000 ; j++)
  
 {
      sum+=array[j];

    } 

       printf("Testing without threads, Sum is : %d \n",sum); 

  

}

// This function reads a file with 1000 integers,
 an integer is stored in 
// each line.The function stores the integers in the array

void readfile(char* file_name)

{

   char ch;
 
  
   FILE *fp;
    
    
   fp = fopen(file_name,"r"); // read mode
 
   if( fp == NULL )
   {
      perror("Error while opening the file.\n");
 
     exit(EXIT_FAILURE);
   }
   
 
    char line [5];
 /* line size */ 

    int i=0;
 
 
   printf("Reading file: ");   
 
    fputs(file_name,stdout);

    printf("\n");

    
    while ( fgets ( line, sizeof line, fp) != NULL ) /* read a line */
    {
       if (i < 1000)
       {
         array[i]=atoi(line); 
 
       }

        //debug code
        //fputs ( line, stdout ); /* write the line */
      i++;
  

  }

    
    // debug code 
    //printf("i is : %d \n",i);

 
   fclose(fp);

    printf("Reading file Complete, integers stored in array.\n\n"); 

   

}

 
int main(int argc, char* argv[])
{
   
   if (argc != 2) {
	fprintf(stderr,"usage: a.out <file name>\n");

	/*exit(1);
*/
	return -1;
 

   }

   readfile(argv[1]);


 
  //Debug code for testing only
   testSum();

 
 
 return 0;


}

GeneralRe: threads ( c language ) in Ubunt Pin
Eng \ zeyad3-Dec-14 0:53
Eng \ zeyad3-Dec-14 0:53 
AnswerRe: threads ( c language ) in Ubunt Pin
Albert Holguin3-Dec-14 3:55
professionalAlbert Holguin3-Dec-14 3:55 
QuestionHow to use overwriting circular buffer for printing strings in c programming? Pin
ShashiAcharya29-Nov-14 22:38
ShashiAcharya29-Nov-14 22:38 
SuggestionRe: How to use overwriting circular buffer for printing strings in c programming? Pin
Richard MacCutchan29-Nov-14 23:21
mveRichard MacCutchan29-Nov-14 23:21 
AnswerRe: How to use overwriting circular buffer for printing strings in c programming? Pin
jschell30-Nov-14 6:11
jschell30-Nov-14 6:11 
AnswerRe: How to use overwriting circular buffer for printing strings in c programming? Pin
CPallini2-Dec-14 9:10
mveCPallini2-Dec-14 9:10 
Questionwindows version of message queue? Pin
neodeaths29-Nov-14 6:55
neodeaths29-Nov-14 6:55 
AnswerRe: windows version of message queue? Pin
Richard MacCutchan29-Nov-14 23:23
mveRichard MacCutchan29-Nov-14 23:23 
AnswerRe: windows version of message queue? Pin
Albert Holguin1-Dec-14 4:20
professionalAlbert Holguin1-Dec-14 4:20 
Questionhow to use message queue in windows Pin
neodeaths29-Nov-14 6:47
neodeaths29-Nov-14 6:47 
AnswerRe: how to use message queue in windows Pin
Richard MacCutchan29-Nov-14 23:24
mveRichard MacCutchan29-Nov-14 23:24 
AnswerRe: how to use message queue in windows Pin
jschell30-Nov-14 6:18
jschell30-Nov-14 6:18 
AnswerRe: how to use message queue in windows Pin
Albert Holguin1-Dec-14 3:59
professionalAlbert Holguin1-Dec-14 3:59 
QuestionImageHlp.h and DbgHelp.h in the same program Pin
Richard Andrew x6428-Nov-14 8:33
professionalRichard Andrew x6428-Nov-14 8:33 
AnswerRe: ImageHlp.h and DbgHelp.h in the same program Pin
CPallini29-Nov-14 0:04
mveCPallini29-Nov-14 0:04 
QuestionDllMain safety Pin
Richard Andrew x6425-Nov-14 11:09
professionalRichard Andrew x6425-Nov-14 11:09 
AnswerRe: DllMain safety Pin
«_Superman_»25-Nov-14 18:51
professional«_Superman_»25-Nov-14 18:51 

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.