Click here to Skip to main content
16,017,261 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralYou cannot use LogonUser to log on to a remote computer Pin
zhongwenjia3-Jun-07 17:33
zhongwenjia3-Jun-07 17:33 
GeneralRe: You cannot use LogonUser to log on to a remote computer Pin
David Crow4-Jun-07 2:36
David Crow4-Jun-07 2:36 
Questioncharecter input system function Pin
sonavi3-Jun-07 14:45
sonavi3-Jun-07 14:45 
QuestionRe: charecter input system function Pin
David Crow3-Jun-07 16:38
David Crow3-Jun-07 16:38 
Questionhow to know which column been clicked CListCtrl Pin
swarup3-Jun-07 14:41
swarup3-Jun-07 14:41 
AnswerRe: how to know which column been clicked CListCtrl Pin
Naveen3-Jun-07 15:56
Naveen3-Jun-07 15:56 
AnswerRe: how to know which column been clicked CListCtrl Pin
Nelek3-Jun-07 20:29
protectorNelek3-Jun-07 20:29 
Questionproblem reading file in C++ newbie here ;) Pin
GatoFedorento473-Jun-07 12:40
GatoFedorento473-Jun-07 12:40 
Hi all. I'm working on a project to a subject in university and i'm going through a hard time trying in everyway i know and looking out in the net for solutions but i cant figure it out.
So the objective is to mix Visual Basic with a DLL made from C++. with simple functions it works, but now im calling from VB a function in the DLL sending one number and the function should go to the .txt and find the number of the line that number is. as it wasnt working i tryied in a simple c++ project with a main to do a "manual debugging" with returns and printfs. lol so here is the code. (don't mind the includes here, they're just there because they came with the copy-past from the DLL.) btw the most part of this code was copied from the internet and "moulded" to my problem.


#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<fstream>
#include <string>

int escolha_cod(double saldo,int escolha)
{

FILE *codigo;
int i=0,linha=0,j=0,aux=0;
char vec[2];
using namespace std;

string line;
ifstream myfile ("codigo.txt");

if (myfile.is_open())
{
for(i=0;i<10;i++)
{

getline(myfile,line);

const char *c_line;
strncpy(vec,line.c_str(),3);

aux=atoi(&vec[0]);

if(aux==escolha)
{linha=i;
i=10;}
}
myfile.close();
}return 47;

}

int main()
{int var;
var=escolha_cod(10,12);
printf("%d",var);
getchar();
return 0;}


If i put the "return 47;" right after "if (myfile.is_open()){" the printf says: 4403792Confused | :confused:

any idea? i would really appreciate a quick answer =) thks in advance guys!
AnswerRe: problem reading file in C++ newbie here ;) Pin
Stephen Hewitt3-Jun-07 14:03
Stephen Hewitt3-Jun-07 14:03 
QuestionRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento473-Jun-07 19:42
GatoFedorento473-Jun-07 19:42 
AnswerRe: problem reading file in C++ newbie here ;) Pin
Stephen Hewitt3-Jun-07 19:46
Stephen Hewitt3-Jun-07 19:46 
GeneralRe: problem reading file in C++ newbie here ;) [modified] Pin
GatoFedorento473-Jun-07 19:51
GatoFedorento473-Jun-07 19:51 
GeneralRe: problem reading file in C++ newbie here ;) Pin
David Crow4-Jun-07 2:29
David Crow4-Jun-07 2:29 
GeneralRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento474-Jun-07 4:36
GatoFedorento474-Jun-07 4:36 
GeneralRe: problem reading file in C++ newbie here ;) Pin
David Crow4-Jun-07 4:48
David Crow4-Jun-07 4:48 
GeneralRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento474-Jun-07 5:30
GatoFedorento474-Jun-07 5:30 
GeneralRe: problem reading file in C++ newbie here ;) Pin
David Crow4-Jun-07 5:38
David Crow4-Jun-07 5:38 
GeneralRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento474-Jun-07 5:46
GatoFedorento474-Jun-07 5:46 
GeneralRe: problem reading file in C++ newbie here ;) Pin
David Crow4-Jun-07 5:49
David Crow4-Jun-07 5:49 
AnswerRe: problem reading file in C++ newbie here ;) Pin
David Crow3-Jun-07 16:44
David Crow3-Jun-07 16:44 
GeneralRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento473-Jun-07 19:47
GatoFedorento473-Jun-07 19:47 
GeneralRe: problem reading file in C++ newbie here ;) Pin
David Crow4-Jun-07 2:42
David Crow4-Jun-07 2:42 
GeneralRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento474-Jun-07 6:01
GatoFedorento474-Jun-07 6:01 
GeneralRe: problem reading file in C++ newbie here ;) Pin
David Crow4-Jun-07 6:37
David Crow4-Jun-07 6:37 
GeneralRe: problem reading file in C++ newbie here ;) Pin
GatoFedorento474-Jun-07 6:48
GatoFedorento474-Jun-07 6:48 

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.