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

C / C++ / MFC

 
GeneralRe: C function to call 5 different functions Pin
Member 1213438816-Jan-16 9:18
Member 1213438816-Jan-16 9:18 
QuestionCheck and uninstall a driver programatically using C++ Pin
Prasanth.outofboxt14-Jan-16 22:09
Prasanth.outofboxt14-Jan-16 22:09 
AnswerRe: Check and uninstall a driver programatically using C++ Pin
Jochen Arndt14-Jan-16 22:30
professionalJochen Arndt14-Jan-16 22:30 
QuestionWin32: l need help on filling a combo box [Solved] Pin
Member 1213944214-Jan-16 10:53
Member 1213944214-Jan-16 10:53 
AnswerRe: Win32: l need help on filling a combo box Pin
Richard Andrew x6414-Jan-16 12:09
professionalRichard Andrew x6414-Jan-16 12:09 
AnswerRe: Win32: l need help on filling a combo box Pin
Jochen Arndt14-Jan-16 21:23
professionalJochen Arndt14-Jan-16 21:23 
PraiseRe: Win32: l need help on filling a combo box Pin
Member 1213944215-Jan-16 8:09
Member 1213944215-Jan-16 8:09 
QuestionOpen the file but do not save the args Pin
honor3us13-Jan-16 8:42
honor3us13-Jan-16 8:42 
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>

int main(int *op[]) {
char n;
int total;
int ct = 0, oper1 = 0, oper2 = 0, oper3 = 0, i = 0;
FILE *arq1;

arq1 = fopen("Maq1.log", "r"); //open file
while (!feof(arq1)) {
    n = fgetc(arq1);
    if (n == "\n") { //count lines
        ct++;
        }
    }
op = (int*) calloc(ct, sizeof(int)); //alloc memory
if(op==0) {
    printf("Não houve memoria alocada!\n");
    return 0;
    }
for(i=0;!feof(arq1);i++) {
    fscanf(",,,%d,", &op[ct]); //I think this is the error
    }
for(i=0;i<=ct;i++) { //do the count
    if(op[ct] == 1){
        oper1++;
        }
    if(op[ct] == 2){
        oper2++;
        }
    if(op[ct] == 3){
        oper3++;
        }
    }
total = oper1 + oper2 + oper3;
printf("Operacao 1: %d \n Operacao 2: %d \n Operacao 3: %d \n Total: %d \n", oper1, oper2, oper3, total); //and print!
fclose(arq1);
return 0;
}


Can you guys help me on this Code? I have no idea of what is happening, but when I run the code he prints
HTML
Operacao 1: 0 
Operacao 2: 0 
Operacao 3: 0 
Total: 0
Sorry for the bad english!

modified 13-Jan-16 15:05pm.

AnswerRe: Open the file but do not save the args Pin
jeron113-Jan-16 9:18
jeron113-Jan-16 9:18 
GeneralRe: Open the file but do not save the args Pin
honor3us14-Jan-16 0:46
honor3us14-Jan-16 0:46 
SuggestionRe: Open the file but do not save the args Pin
David Crow13-Jan-16 9:33
David Crow13-Jan-16 9:33 
GeneralRe: Open the file but do not save the args Pin
honor3us14-Jan-16 0:56
honor3us14-Jan-16 0:56 
QuestionRe: Open the file but do not save the args Pin
David Crow14-Jan-16 2:33
David Crow14-Jan-16 2:33 
AnswerRe: Open the file but do not save the args Pin
honor3us14-Jan-16 3:51
honor3us14-Jan-16 3:51 
AnswerRe: Open the file but do not save the args Pin
David Crow14-Jan-16 3:52
David Crow14-Jan-16 3:52 
SuggestionRe: Open the file but do not save the args Pin
k505413-Jan-16 11:39
mvek505413-Jan-16 11:39 
GeneralRe: Open the file but do not save the args Pin
honor3us14-Jan-16 0:57
honor3us14-Jan-16 0:57 
GeneralRe: Open the file but do not save the args Pin
k505414-Jan-16 3:52
mvek505414-Jan-16 3:52 
AnswerRe: Open the file but do not save the args Pin
honor3us15-Jan-16 2:44
honor3us15-Jan-16 2:44 
SuggestionRe: Open the file but do not save the args Pin
David Crow15-Jan-16 3:49
David Crow15-Jan-16 3:49 
Questiondoubt in typdef segregation one class in two Pin
narsi8112-Jan-16 18:50
narsi8112-Jan-16 18:50 
SuggestionRe: doubt in typdef segregation one class in two Pin
Jochen Arndt12-Jan-16 20:53
professionalJochen Arndt12-Jan-16 20:53 
QuestionVisual Studio 2016 & MFC Pin
BarryPearlman11-Jan-16 16:54
BarryPearlman11-Jan-16 16:54 
AnswerRe: Visual Studio 2016 & MFC Pin
Jochen Arndt11-Jan-16 20:52
professionalJochen Arndt11-Jan-16 20:52 
QuestionMFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 4:30
Member 1120327711-Jan-16 4:30 

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.