|
Hi everybody,
I am reading XML and using the XMl data for calling some functions in a DLL
I have a problem:
i am taking one (String *str;) pointer, which is assigned with a value returned from one of the XML function. Now i want to convert this String value into integer value.
Can someone tell me that how i can do this??
Thanks in advance,
ADARSH
|
|
|
|
|
ADARSH
Try int x = Convert::ToInt32(str); or int x = Convert::ToInt16(str);
Convert has several conversions available.
Cheers
John
|
|
|
|
|
Hi everybody,
I'm trying to build a dll file in VC++ .NET 7.1 . The Compiling of the code was OK, but when I'm trying to build the dll I recieve these errors:
c:\test\projatldll\projatldll\first.h(29) : error MIDL2025 : syntax error : expecting a type specification near "ostringstream"
c:\test\projatldll\projatldll\first.h(29) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
LINK : fatal error LNK1240: failed to compile IDL content
Can anyone help me to get rid of this situation ???
Thanks in advance..
regards,
ADARSH
|
|
|
|
|
ok this is annoying...the following line is killing vs...(hate this)
containerListViewItem2->Tag = __box(0);
ive seen this problem before, its like when you add components to c++ .net...if it makes this __box command it kills the visualizer and only way to fix is to continiously delete that line from form1.h and offcurce vs.net re adds it
|
|
|
|
|
hi
i am having a problem with an infinite loop
can someone check out the code and tell me
what is wrong with it...
[code]
int main()
{
int numberOfResponses; //number of responses for candidates
int accumulator = 0; //adds up total number of votes
do
{
char* stateName = new char[30]; //char pointer array for stateName
char* dateOfPrimary = new char [30]; //char pointer array for date of primary
cin.getline(stateName,30) ;
cin.getline(dateOfPrimary,30);
cin >> numberOfCandidates;
primaries NewPrimary(stateName,dateOfPrimary);
cout << NewPrimary <<endl;
delete="" []="" statename;=""
delete="" dateofprimary;=""
for="" (int="" i="0;" <="numberOfCandidates;" i++)=""
{=""
char="" nameandspent[50];="" char="" array="" for="" name="" and="" money="" spent=""
cin.getline(nameandspent,50);=""
if="" (i="" !="0)"
candidates="" newcandidate(nameandspent);=""
cout="" <<="" newcandidate="" endl;=""
}=""
results="" newresults;=""
int="" votes;=""
cin="">> votes;
accumulator = accumulator + votes;
NewResults.voteArray[i-1] = votes;
}
NewResults.totalNumberOfVotes = accumulator;
NewResults.percentage();
cout << NewResults << endl;
cin >> numberOfResponses;
for (int i = 0; i <= numberOfResponses; i++)
{
int c, i, v;
cin >> c;
cin >> i;
cin >> v;
election MyElection(c,i,v);
}
char blank[5];
cin.getline(blank,5);
cin.getline(blank,5);
}while(!cin.eof());
return 0;
}
[end code]
the INPUT is like this:
Iowa
January 19, 2004
6
Kerry 50000
Clark 20000
Dean 40000
Gephardt 20000
Lieberman 10000
Edwards 40000
1128
83
540
318
60
957
15
1 2 8
3 2 5
1 3 6
1 1 6
6 1 7
5 2 5
2 4 7
4 3 6
6 2 7
1 4 9
6 4 7
3 4 7
2 3 6
1 4 8
4 2 6
New Hampshire
January 27, 2004
5
Kerry 500000
Clark 200000
Dean 400000
Lieberman 100000
Edwards 50000
84229
27254
57788
18829
26416
25
1 2 8
3 2 7
1 3 6
1 1 7
3 1 7
5 1 7
2 4 6
5 3 6
4 1 4
1 4 9
3 4 8
1 2 7
2 1 7
3 2 8
4 2 6
5 2 8
2 2 6
3 3 7
1 2 8
2 3 7
3 2 7
4 4 6
5 4 7
2 2 6
3 3 6
ps....if i use just one set of data...my program works...but when i add another set of data....such as above (there are two) one for iowa and one for new hampshire...it keeps going on forever...help please
|
|
|
|
|
Somehow I dont think you can managed Managed Extensions for C++....
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
How can I read a number from a text file?
Mayber there are two numbers in an text file,:
4578 8956
How can I read it as tow numbers: 4578, 8956 respectively?
Thank you!;
|
|
|
|
|
Hi everybody,
Can anybody help me by sending some examples of how to read XML in C++ using SAX ?
Basically, i want to read XML in C++ using SAX and based on the data got from the XML i want to call some C++ functions developed by me.
Thanks in advance,
ADARSH
S.E.Biz Infotech Pvt. Ltd.,
Chandigarh
|
|
|
|
|
|
when I #include "windows.h" and #include "mmsystem.h"
and build my program it will be orcurr an error :
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\ServProv.h(99): error C2371: 'IServiceProvider' : redefinition; different basic types
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\ServProv.h(92): error C2872: 'IServiceProvider' : ambiguous symbol
help me how to fix it, because i want use mciSendString to play an audio file.
thanks
Nho'c Ti`
|
|
|
|
|
Hi' im used to c#, and c++'s excessive use of tabbing in and nextlinning is erking me.
For example. instead of like this (note "......." is just cause im tryin to tabe this stuff over)
private:
.......System::Void button1_Click(System::Object * sender, System::EventArgs * e)
.......{
.......Form2* f =new Form2();
.......f->Show();
.......}
i want it like this!
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
.......Form2* f =new Form2();
.......f->Show();
}
Also, is their any way to make everything lineup proper when you type the closing bracket } , like in c# it auto tabbed in stuff to make it neat and speeded up my work... I need these things to use this managed c++ or im gonna freak.
Lastly, whats the equlivaant of #region and #endregion, cause i got all this code i want to conver to c++ managed, and i used that thing tons of times to make my code neat
|
|
|
|
|
I am writing a game addon using .NET in managed code. I have a struct that has a few char[64] entries to be compatable with the unmanaged sections of my code. I want to open a file and either read or write using the char[64] characters. I tried using StreamReader, but it only returns managed type code (String* or __wchar_t) and can't write to the char[64] members. There are also some doubles, ints and bools that need to be read/written. I tried using iostream but it doesn't seem to work because of multiple errors with the header. How can I do this?
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
he mate..how r ya....call me dj_oden okay...just see me as a passer by and a stranger ..so dont need to know my name....anyways for an answer to what you've said...i have a perfect script for you...it's based on...tri overlooping...so at that point...you can get it to operate in many oss....os/1 or os/2 even...anyways...i cant sendit to you ....from here..so maybe you can give me your email addy..that'll be good...or you can contact me on ...crypto_000@hotmail.com
dj_oden@$%$&^highlander
|
|
|
|
|
hi james...
are you getting link errors or compile errors?
i am trying to do the same thing and everything works ok, but i get a heap of LNK2020/LNK2019 errors etc...
cheers
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
em: nikolaos.vogiatzis@unisa.edu.au
|
|
|
|
|
hi james,
ok, i think i worked it out...
below is some code i wrote to do basically the same thing...
unsigned int c, c2;
BinaryReader *br;
br = new BinaryReader(File::OpenRead(sFilename));
c = (unsigned int) br->ReadByte();
c2 = (unsigned int) br->ReadByte();
now in my case i need to know at what point in the code i am as i get records from traffic control systems, and they give you the record length LOB as a 2-byte field followed by the actual data, however, if you don't need this capacity, then you can use the ReadByte function until you get to the end of the file...
what i did is wrap the whole thing in a try/catch block as if you attempt to read passed the EOF it will throw an exeception, so that is a good way to get out of any read loop you may have and then use it as an excuse to close the file...
anyway, hope this helps...
cheers
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
|
|
|
|
|
Thanks, I did as u said..
I chaged my Typedef call to call a diff:function
typedef VOID (*MYPROC)(int,int,int,int,int,int,int,int,LPSTR,LPSTR,int,int);
MYPROC ProcAdd;
HINSTANCE hLib1 = LoadLibrary("BCBitmap.dll");
ProcAdd = (MYPROC) GetProcAddress(hLib1,"SetBCAttributes");
if (NULL != ProcAdd)
ProcAdd(2,1,10,10,25,1,3,0,"1234","ARIAL",10,600);
I get the following Error:
The Functions Iam using was implemented using delphi.
The Value of ESP was not properly saved across a function call.This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
The function is this one under Delphi:
#define BC_EXPORT __declspec(dllexport)
/*BC_EXPORT bool SetBCAttributes(int Bar_Type,
int Bar_Mod,
int Bar_Height,
int Bar_Width,
int Bar_Ratio,
int Bar_Height_Mul,
int Bar_Hri,
int Bar_Color,
char* Bar_Text,
char* FontName,
int FontHeight,
int Resolution)*/
What should I do now?
Thanks....
|
|
|
|
|
I have 3 third party Dll's developed under Delphi & I would like to call some functions from these Dll's.
I have a c++ console application.
[1] Where should I put these Dll's?(I mean which the path)
[2]Do I need to change any settings in my console project.
Thanks....
|
|
|
|
|
Anyone know a simple way to convert a String* variable to a LPTSTR variable?
|
|
|
|
|
The easiest way is
pStr->GetBuffer(0)
Before using you should read the commands in MSDN because you have pay attention by modifying the content of the string.
|
|
|
|
|
Dirk, Thanks for the response.
I seem to be a bit thick headed, I don't understand what you are suggesting. What data type is pStr? The compiler does not recognize GetBuffer as a member of LPTSTR or of .Net String class. It is a member of .Net MemoryStream class. How do you propose that I do this?
What I am doing now to convert a String* variable named line to a LPTSTR (char*) is:
char* chars = new char[line->length+1];
for (register i = 0; i < line->length; i++) {
chars[i] = (char)line->Chars[i];
}
//Add the NULL at the end
chars[line->length] = '\0';
The above seems to work but it just seems like a lot of processing to just convert from one data type to another. I'm thinking that there must be a more straightforward way.
Thanks
John B
|
|
|
|
|
hi john,
try the MS website...
(http://support.microsoft.com/?kbid=311259[^])
they provide 3 methods, method 3 being the easiest...
cheers
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
em: nikolaos.vogiatzis@unisa.edu.au
|
|
|
|
|
Nik
Thanks for the tip
Actually, the only method that worked for me was method 2.
Method 3 would not compile. The include altstr.h produced IServiceProvider error.
Method 1 compiled OK, but I had to use a LPSTR cast to get it to compile. However, it produced a number (34") regardless of the value of the String* that I fed it.
Perhaps there are ways to get methods 1 & 3 to work, but I don't know enough about .Net to figure out how.
Cheers and best wishes in your PhD effort.
John
|
|
|
|
|
Is there a method in C++ .NET to emulate a real time loop while still using the managed forms editor?
while(true)
{
if(PeekMessage(msg, hWnd, 0, 0, PM_REMOVE)
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
fGameLoop();
}
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
Hi,
how can i add the XP style to my managed visual c++ app?
Cheers
Skute
|
|
|
|
|