Hi everyone,
i have a simple question, im not expert with C++ stuff,
the question is, my SW is wearching into a text file for a string, then i need to show that string in a Messagebox, and later i will pass it to FPGA,
the question not related to FPGA, its a simple C++ (i think), here is my code
while(!srcfile.eof()) //here im looking for the string i want
{
getline (srcfile,line);
int offset;
if ((offset = line.find(first, 0)) != string::npos) {
cout << "found '" << first << "' @ offset " << offset << endl;
break;
}
i++ ; //line number
}
MessageDlg("found at line." + i , 0); //here im trying to show the line number in messagebox, BUT i receive this error
[BCC32 Warning] : W8012 Comparing signed and unsigned values
[BCC32 Error] : E2285 Could not find a match for 'MessageDlg(const wchar_t *,int)'
If you want some kind of graphical message box, it will depend on your operating system and your choice of graphical user interface library.
Edit: I'm guessing that you're using Borland C++, which does come with some libraries that have a MessageDlg function. The function has the following prototype:
int __fastcall MessageDlg(const AnsiString Message,
TMsgDlgType IconType,
TMsgDlgButtons Buttons,
int HelpContext);
You need to provide a value for each input parameter to use it.
And how about if you create the string you want first, and then put it into the MessageBox call?
"count:" is a const* char, so "count:" + int is pointer arithmetic - not string concatentation. Put another way, "some string" + 7 does not give you "some string7"