|
Is there any link which talks about file handling in mc++.
I have to specify the write mode for the file. I mixed both managed and unmanged code. From managed code i have to call unmanged code with the first parameter file name second parameter file mode(write mode)..How to specify the file mode.
pOap->Open(szTemp,FileWriteMode);
|
|
|
|
|
Hello ...If I have values for "H","D" given from the interface and I want put a message if the value for D from the interface is grater then 2*H
(let say I give value from the inteface for H=230 and for D=700 but 700>2*H to show me an error that "You must specify D less than 460 "
if (D > 2*H)
{
MessageBox::Show("You must specify D less then ......2*230(2*H).... ", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error, MessageBoxDefaultButton::Button1/*, MessageBoxOptions.DefaultDesktopOnly*/);
return;
}
Y don't know if I can use MessageBox for this..can you help me...please
|
|
|
|
|
You could use String.Format() to format the string...
MessageBox::Show(String::Format("You must specify D less then {0} (2*H)", (H*2).ToString()),
"Error", MessageBoxButtons::OK, MessageBoxIcon::Error, MessageBoxDefaultButton::Button1/*,
MessageBoxOptions.DefaultDesktopOnly*/);
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
if (D > 2*H)
{
AfxMessageBox(CString("You must specify D less then ......2*230(2*H).... "));
return;
}
It will work.
Anurag Gandhi.
Bangalore, India.
|
|
|
|
|
|
When i compile my application in release mode i am getting the below warning
Warning 1 warning LNK4248: unresolved typeref token (0100001E) for 'CRawChro'; image may not run FConvert.obj
But there is no class or variable or struct whi the name CRawChro.
Where to look for this kind of warning.
Thanks in advance.
Regards, Eswari
|
|
|
|
|
when i looked into the google it said provide stucture definitions. I have two structures in the class and they are as follows:
public ref struct FConvertRecord
{
public:
String^ szSourceName;
String^ szSourcePath;
String^ szDestName;
String^ szDestPath;
String^ szError;
ConversionStatus eStatus;
ConvertFileFormat eSourceFormat;
ConvertFileFormat eDestFormat;
bool bSourceIsRemote;
bool bDestinationIsRemote;
bool bCommandLineProcessing;
int iReserved;
int iErrorId;
};
public ref struct FConvertFileFormatInfo
{
public:
ConvertFileFormat eFormat;
String^ szFormatName;
String^ szFilter; // should be NAME.EXT or *.EXT or NAME.* etc
unsigned long ulAttribs; //Can Be SFGAO_FILESYSTEM to indicate FILE or SFGAO_FOLDER to indicate Directory.
};
But there is no CRawChro in the project. What is the warning pointing to?
Regards, Eswari
|
|
|
|
|
I am looking for examples on how to do this. I found one article in CP that looks like what I want, except that it is done using CSS (http://www.codeproject.com/useritems/Outlook_Style_Menu.asp[^])
What I want is a menu bar that collapses into the side of a dialog window and can be pulled-out when needed - like what one sees in video/media players.
Thanks,
Johnny
|
|
|
|
|
hi..i've a problem with a prject in Visual c++...i've this class:
class A{
public:
A();
void jpeg_received(jpg_t* jpg);
void exit_capturing(int code);
int rec(void);
public:
camaddr_t camaddr;
CAPID capid;
};
A::A()
{...}
void A::jpeg_received(jpg_t* jpg)
{....//code to save a file jpg...}
void A::exit_capturing(int code)
{....//code to print a result for code's value...}
int A::rec(void)
{.......
capid=ccap_start_capturing(&camaddr,jpeg_received,exit_capturing);
..........}
I've to pass to ccap_start_capturing
(function defined in a 'c file' of another project
PUBLIC CAPID ccap_start_capturing(camaddr_t* camaddr, void(*jpeg_received)(jpg_t* jpg), void(*exit_capturing)(int code) )
two function "jpeg_received" and "exit_capturing" but i've this compile error:
.\A.cpp(114) : error C3867: 'A::jpeg_received': function call missing argument list; use '&A::jpeg_received' to create a pointer to member
.\A.cpp(114) : error C3867: 'A::exit_capturing': function call missing argument list; use '&A::exit_capturing' to create a pointer to member
Can anyone help me?
Thanks, regards.
|
|
|
|
|
This should be posted on the Visual C++/MFC[^] board.
The error messages state what needs to be done to get the address of a member function.
Note that this still won't compile because the member functions are not declared static, which
means there's an implicit "this" pointer passed to the methods.
One way to get it to compile:
class A
{
public:
A();
static void jpeg_received(jpg_t* jpg);
static void exit_capturing(int code);
int rec(void);
public:
camaddr_t camaddr;
CAPID capid;
};
...
CAPID capid = ccap_start_capturing(..., &A::jpeg_received, &A::exit_capturing);
Note that static methods cannot access non-static member variables/methods.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
The question is as follows:
(Settling time of Dijkstra’s Algorithm)
Write a program, which generates a network with a controllable number of nodes, N. The easiest way to do this is to start with a rectangle with sides X and Y. Use a pair of random numbers, rx(n) and ry(n), to set the coordinates of point, n at X rx(n) and Y ry(n).
Allow n to cover the range 1 to N. Your program must then decide whether a link exists between every pair of nodes in the network. This can easily be done, based on the distance between them. For example, it could be decided that a link exists if the distance between two nodes is less than a certain distance. Or a link could exist depending on some probability function of the distance between them.
Repeat the following experiments with N = 32, 64, 128 and 256.
Extend the program so that it simulates the operation of Dijkstra’s algorithm. This program should carry out the operations of Dijkstra’s algorithm for one node at a time. Start the program with a fixed set of link costs, perhaps one. Plot the settling/convergence time. Note, convergence time is the number of steps it takes to reach a stable routing table.
Allow the program to continue running until all routing tables have stabilized. Now change the value of one link only, and again allow the program to run until all routing tables are stable. Measure the time taken (or the number of iterations) to reach stability. Repeat this experiment 100 times (each time with a different link being changed) and find the average settling time. Also, plot a graph that shows the average time taken for the Dijkstra’s algorithm to converge for different number of links being changed.
In this experiment, simulate the behavior of the network when all routers update their routing tables at the same time. That is, using the same set of link costs. Assume that 150 Mbps is the average traffic offered between each pair of nodes. Experiment also with different number of node pairs. The utilization and the link costs are calculated using the total traffic on a link in either direction. Does the network come to a stable state? What is the settling time? Does the amount of traffic entering the network influence Dijkstra’s settling time?
Repeat the previous experiment where each router updates their routing tables, one at a time, and the traffic is re-calculated between updates. Does the network converge? Plot the settling time.
In your discussions, you must explain the impact of node density (i.e., the number of neighbors a node has) and number of nodes on route convergence.
|
|
|
|
|
Sounds like fun. Is your homework in C++/CLI, or have you both asked a question that no-one is going to answer ( that is, asking for a complete solution to your homework ) AND asked it in the wrong place ?
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 )
|
|
|
|
|
The truth is that i got the question as homework
But i'm not at all familiar with any languages
all I'v learned is the basics
so i went totally blank on seeing this question
so if u could kindly help me out.....
please do if u could.
|
|
|
|
|
MaddySays wrote: But i'm not at all familiar with any languages
Well, then why are you getting this homework assigned to you?
MaddySays wrote: so i went totally blank on seeing this question
The first step is to break it down. No single line of code will do all of this, so think about the various parts and how they need to work in order to come together to make the whole.
And, unless you're using C++/CLI ( C++ with .NET ), ask in the right forum when you're able to ask specific questions.
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 )
|
|
|
|
|
Sorry to ask but which forum should i ask if it is totally based on c++ alone??
|
|
|
|
|
The visual c++ 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 )
|
|
|
|
|
I want to add a "-" to an existing string:
char* sOutString = new char[stringSize];
strcat( sOutString, "-" ); // Results in Warning
but use the new function to avoid the deprecation warning:
strcat_s( sOutString, stringSize, "-" );
But, this is apperently not correct as it crashes on this line. What am I doing wrong and how to I fix it?
EDIT: The above does work... I just did something wrong. All working now. Thx.
|
|
|
|
|
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
|
|
|
|