|
Your core problem is that you're using C. If you're using C++, use the string class. If you're using C++/CLI, consider the String class. Either way, this question is about C or C++, and this is the C++/CLI forum
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have a function for comaring.
int DataPeakCompareFunc(const void *el1, const void *el2)
{
const DataPeak *peak1 = reinterpret_cast<const datapeak="" *="">(el1);
const DataPeak *peak2 = reinterpret_cast<const datapeak="" *="">(el2);
if (peak1->position < peak2->position)
{
return -1;
}
else if (peak2->position < peak1->position)
{
return 1;
}
return 0;
}
this is my qsort function
int (FConvert::OConvevw::*pt2Function) (const void*, const void*) = NULL;
pt2Function = &FConvert::OConvevw::DataPeakCompareFunc;
qsort((void*)pScan, num_readings, sizeof(DataPeak),pt2Function);
But i am getting this error
Error 206 error C2665: 'qsort' : none of the 2 overloads could convert all the argument types d:\cougar_io_development\cougar\core\libraries\cplusplus\dlls\fconvert\OConvevw.h 789
both are residing in oconvevw.h file only.
What to do?
Thanks in advance.
Regards, Eswari
|
|
|
|
|
may be this is the wrong forum to ask.. But i could not see any C++ category.
That's why i posted here
|
|
|
|
|
Yes, this is the wrong forum. See your post here[^] on the correct forum
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am using /clr compiler flag. I am getting these errors while compiling my code.
1.
Error 1 error LNK2028: unresolved token (0A00098C) "int __cdecl GetXcaliburDataPath(class ATL::CStringT<wchar_t,class strtraitmfc_dll<wchar_t,class="" atl::chtraitscrt<wchar_t=""> > > &)" (?GetXcaliburDataPath@@$$FYAHAAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: __clrcall FConvert::FConvertClass::FConvertClass(struct FConvert::FConvertRecord ^)" (??0FConvertClass@FConvert@@$$FQ$AAM@P$AAUFConvertRecord@1@@Z) FConvert.obj
2.Error 2 error LNK2019: unresolved external symbol "int __cdecl GetXcaliburDataPath(class ATL::CStringT<wchar_t,class strtraitmfc_dll<wchar_t,class="" atl::chtraitscrt<wchar_t=""> > > &)" (?GetXcaliburDataPath@@$$FYAHAAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: __clrcall FConvert::FConvertClass::FConvertClass(struct FConvert::FConvertRecord ^)" (??0FConvertClass@FConvert@@$$FQ$AAM@P$AAUFConvertRecord@1@@Z) FConvert.obj
Any help is appreciated.
Thanks, Eswari
|
|
|
|
|
These are linker (not compiler) errors. In your project, ou need to include the file which
contains the implementation of GetXcaliburDataPath(). If it's in an external DLL you need to add
the link library (.lib) file. If it's in one of your source files (.cpp) then make sure that
file is in your project and the linker can find the .obj file for it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I figured it out. Thanks anyway.
Regards, Eswari
|
|
|
|
|
Hello,
at the moment I'm searching some logging possibility that I can use in .net and in native c++. For pure .net implementation I have used until now the Enterprise logging application block. But for the native c++ application I don't cant use this, because in this parts I really need a fast solution.
Does anyone now a solution that works in booth managed and unmanaged parts and is also fast?
Best regards
Hansjörg
|
|
|
|
|
Develop a simple WIN32 dll - Use it from both unmanaged and managed worlds.
Cheers,
Suresh
|
|
|
|
|
Helo...I have my inteface in c++ and I want to take the data from the interface in the main program like this:
int main(array ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
int container = Convert::ToInt32(forminterface::Form1::ContainerWidthtextBox::...., System::Globalization::CultureInfo::CurrentCulture);.........}
in the interface I have a TextBox...ContainerWidthtextBox in which I introduce the data ...how can I use this value in my main ....because it doesn't let me to use:
int container = Convert::ToInt32(forminterface::Form1::ContainerWidthtextBox->Text, System::Globalization::CultureInfo::CurrentCulture);
it give me an error like Error 5 error C2227: left of '->Text' must point to class/struct/union/generic type please help me.......
lavi
|
|
|
|
|
Please help me...how can I get a value in main from my interface....it's a method?...I am disperate..I must solve this...
|
|
|
|
|
Following snippet should give you some idea about usage.
TestForm::Form1^ myform = gcnew Form1();
Application::Run(myform);
MessageBox::Show(myform->textBox1->Text);
-- modified at 5:25 Wednesday 16th May, 2007
Probably, you need better alternative. But, you was facing problem, because, of using object in wrong way, infact, I guess, edit box variable was not recognized by compiler.
Prasad
MS MVP - VC++
|
|
|
|
|
It seems to me Prasad had it right...you need an actual object to access its "Text" property:
Form1^pForm1 = gcnew Form1()
Application::Run(pForm1);
int container = Convert::ToInt32(pForm1->Text, ...);
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
thanks .....I solved the problem
|
|
|
|
|
|
I’m converting an old MFC program to Windows Forms. In one function there is a TIMESTAMP_STRUCT type. That is defince in an MFC library function (afxdb.h).
I can’t find a replacement for this library. Any leads to locating a way to replace this would be very helpful.
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
TIMESTAMP_STRUCT is an ODBC type defined in sqltypes.h.
It looks pretty similar to a Windows SYSTEMTIME structure or a .NET System.DateTime struct.
Are you looking for a database class/framework replacement or just for the time struct?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I think this will work. Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Right now I'm creating a program that declares a structure, which also has enum inside it. Now I believe I declare the structure right, but the next step is to create a loop that has the user enter 5 different items of data for library information. But I have to use pointers, so when the loop runs and I enter the information, the data has to be sent to a structure variable only once all six attributes are entered, and the pointer values should be used to create the structure.
I was given an example:
cin >> a;
cin >> b;
library.dewey = &aptr;
This is my code so far:
struct card_catalogue<br />
{ <br />
float dewey;<br />
string title;<br />
string author;<br />
int released;<br />
int num_pages;<br />
enum type {fiction = 1, non-fiction, reference, pond};<br />
};<br />
<br />
int main()<br />
{<br />
return 0;<br />
}<br />
|
|
|
|
|
Why would you post this question in the C++/CLI forum? I would think being able to 'read' would be a prerequisite for whatever course this assignment is from.
led mike
|
|
|
|
|
Hello... I have a function which takes my data from "Contload.xml"...and put it in the variable "Wc", how can I use this variable in the main program ...so that it be able to see it in the console.....
void readfromfile(String^ strFName,int Wc)
{
strFName = gcnew String("e:\\Contload.xml");
DataSet^ dataset = gcnew DataSet();
dataset->ReadXml(strFName);
DataRowCollection^ rows;
int Wc,Hc, Dc,idi,ix;
int id[100];
int w[100];
rows = dataset->Tables[0]->Rows;
for each (DataRow^ row in rows)
{
Wc = Convert::ToInt32(row["ContainerWidth"], System::Globalization::CultureInfo::CurrentCulture);
}
how can I cal this "Wc" in the main ...?
int main(int argc, char *argv[])
{
String^ filename = gcnew String("e:\\Contload.xml");
readfromfile(filename);
Console::WriteLine("Width: {0}",Wc);b>
lavy
|
|
|
|
|
Maybe
Console::WriteLine("Width: {0}", Wc.ToString());
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
If you want both readfromfile and Main to know about the variable Wc, then one option is to use what is called 'file scope'. If you define 'Wc' in file scope, then the variable becomes global for this ONE file. You simply define 'int Wc;', or perhaps 'static int Wc;' at the top of your file. Now you can use Wc anywhere in this file.
The current code will only print out the last result of Wc. Is that what you want? If you want to print Wc for each loop, you will need the WriteLine inside the for loop.
|
|
|
|
|
|
Hi,
I declared a managed struct
public ref struct FconvertRecord
{
};
This i am using in unmanaged class like this
Convert(FconverRecord *);
But this is giving error missing ; before *.
Thanks in advance.
Regards, Eswari
|
|
|
|