|
Sriinii wrote: Thanks we got an idea. but this doesn't work on class ,string and structures
In what way does it not work?
Regards,
Nish
|
|
|
|
|
You have to do the following:
<br />
void GetStringReturn(String^% stringValue)<br />
{ <br />
stringValue = "10"; <br />
}<br />
-- modified at 14:59 Friday 3rd February, 2006
|
|
|
|
|
This is gr8 it is working for me.
Thanks George, Nishant.
Thank u very much
Regards,
Srini
|
|
|
|
|
Does anybody know how to get share permissions?
Kelvin Chikomo
|
|
|
|
|
How to convert binary file to text file in C++?
Premalatha
|
|
|
|
|
What do you mean by this ?
You mean converting an executable (which is a binary file) into a text file for example ?
And what do you mean also by text file ? Something like transforming your binary file into source file or something like that ? (that is not possible, or not easily at least...)
-- modified at 2:55 Tuesday 24th January, 2006
By the way, this is the forum for managed and not the C++ forum. You should post in the future in the Visual C++ forum because your question is purely related to C++
|
|
|
|
|
Could You be more specific, pls ?
What type of binary file u have, and what info is stored in it ?, etc ...
|
|
|
|
|
This program converts a .bin to a readable file but it also increase the overall size(not good) any help or ideas.
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
unsigned char a1[16];
unsigned char a2[16];
unsigned int tempWRITE;
//FILE *in = fopen("c:/test.bin","r");
FILE *in = fopen("c:/test.bin","rb");
FILE *out = fopen("c:/new.txt","w");
while(!feof(in)) {
fread(a1,1,16,in);
a2[0] = a1[3];
a2[1] = a1[2];
a2[2] = a1[1];
a2[3] = a1[0];
a2[4] = a1[5];
a2[5] = a1[6];
a2[6] = a1[4];
a2[7] = a1[7];
a2[8] = a1[9];
a2[9] = a1[11];
a2[10] = a1[8];
a2[11] = a1[10];
a2[12] = a1[14];
a2[13] = a1[12];
a2[14] = a1[15];
a2[15] = a1[13];
fwrite(a2,1,16,out);
}
fclose(in);
fclose(out);
return 0;
}
1. Out of clutter, find simplicity.
2. From discord, find harmony.
3. In the middle of difficulty lies opportunity.
Albert Einstein
three rules of work
|
|
|
|
|
Hi all....
Maybe you all think this is a silly question, but this problem really disturbing me. The problem is set default namespace for multiple class file. The problem is like this :
at the first file i type :
namespace NSA {
namespace NSB {
//Class statement here.
}
}
The problem came when we create a multiple class file (using Project->Add Class menu) but have same namespace like above. Old way is I type the namespace structure like above in every file. Then i thinking if i create more then 10 class file then i must type the same namespace for 20 times (so you know what will came if we create 3 or more namespace level).
I found in the project properties window (not the pop up) the property call "Root Namespace", I have set up like this "NSA" then in evey file i only type namespace "NSB". But then in the object browser only came the "NSB" namespace. (Doesn't help anyway i think).
Please reply soon, OK.
Thanks for help of you all.
|
|
|
|
|
|
Yes. Copy And Paste.
you can name class like:
NSA_class1, NSA_NSB_class2, NSA_NSC_class3.
If you are making more simple program, then one namespace is more than enough.
What kind of program are you making, that you need so much namespace nesting?
I had created a smoll project with a name test.
//test.h
#pragma once
namespace NSA
{
namespace NSB
{
public ref class test1{};
}
namespace NSC
{
ref class test2{};
ref class test3{};
}
}
// tes.cpp : main project file.
#include "stdafx.h"
#include "test.h"
using namespace NSA;
using namespace NSA::NSB;
using namespace NSA::NSC;
#include "Form1.h"
using namespace tes;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew Form1());
return 0;
}
//form.h
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
test1 ^t1 = gcnew test1;
test2 ^t2 = gcnew test2;
test3 ^t3 = gcnew test3;
}
|
|
|
|
|
Well the point is not make so many level namespace, but I create so many file for same namespace (I a little bit confuse if see so many class/source code lines in one file). But if i copy paste the namespace then i must do it for 10 times if i create 10 file (I usually use add class wizard, it easiest way creating class).
Have you use Visual C#, in the project properties, application tab, it have a field that said "Default Namespace", if we set it for example "NSA.NSB", then when we add a class using the Diagram or Add Class Wizard the file automatically add code "namespace NSA.NSB".
For example we add a class called Test using the wizard, then we will have file named Test.cs and the code inside it (we have set the default namespace first, and it called "NSA.NSB") :
namespace NSA.NSB // <- This is auto generate by wizard by setup default namespace.
{
public class Test
{
//TODO: Class logic here.
}
}
With the code i hope you all understand what i mean.
Thanks.
|
|
|
|
|
Now i understand what you mean. The anser to your question is: You can't, not in c++. If you want to do it more quickly, then have a notepad and have your namespace ready. Create new code, copy paste from notepad and write 1 line to create class.
|
|
|
|
|
A few days ago I described a problem of Managed extensions with System.Security.Policy.PolicyException. Nishant Sivakumar suggested I try Adding Assemblies to Security Policy, which was a good idea. Unfortunately, up until now, I haven’t been able to make it fly. In this page there is a sentence “Before you add an assembly to security policy, you must give it a strong name and put it in the global assembly cache.” I haven’t exactly understood how to give my program a strong name and put it into the global assembly cache. When I tried according to the example on the same page, it didn’t work.
I see that the basic idea was sound since turning off security by “caspol –s off” made the program begin to work over the LAN. Turning off security isn’t exactly a great idea, so I turned it back on again.
I looked at the neighboring pages and it talks about reasonable things like System.Data.SqlClient.SqlClientPermission, which I in fact use. It doesn’t list individual programs, like I have built.
I decided to do an experiment. I took another program which I wrote, which doesn’t use managed extensions and tried to run it from the same “temp” directory, which I shared as z:\temp. It worked both from the local disk, temp, and from the LAN z:\temp. I then recompiled it using Managed Extensions. Clearly it was using absolutely nothing from managed extensions, but was just compiled using the option. Now it worked on the local computer but failed the same way on the LAN.
This implies that EVERY program which uses managed extensions in even the most trivial way will have problems. This seems to me to be absolutely crazy. How can anyone get any work done? There has to be a more general solution. Maybe it is a problem of version numbers between my Visual Studio 2003 and my latest version of XP?
Any suggestions would be welcome.
Thanks,
Ilan
|
|
|
|
|
IlanTal wrote: Turning off security isn’t exactly a great idea, so I turned it back on again
Good, turning off the security is a really bad idea.
Why do you want to run it from the LAN?
If you try and update the binaries and a user has them launched from the network you won’t be able to. Consider the advice from my previous post.
Your Network admins will thank you...
|
|
|
|
|
Turning off security was just a method to prove where the problem is.
I already bought your idea from the previous post. When you suggested it for the compiled help, I immediately realized it would work here as well.
The original idea of running from the network was to guarantee that all users are using the same software, but the intelligent download works just as well (or even better from a bandwidth point of view).
|
|
|
|
|
IlanTal wrote: I already bought your idea from the previous post. When you suggested it for the compiled help, I immediately realized it would work here as well.
Simplicity.
|
|
|
|
|
IlanTal wrote: This implies that EVERY program which uses managed extensions in even the most trivial way will have problems. This seems to me to be absolutely crazy. How can anyone get any work done? There has to be a more general solution. Maybe it is a problem of version numbers between my Visual Studio 2003 and my latest version of XP?
I believe this is part of the .NET security model. Dig into that, in the end you will find it more preferable to deploy locally.
|
|
|
|
|
The simplicity of your suggestion of deploying locally means that I don't have to bother with the .NET security bag of worms. As they say "KISS" - keep it simple, stupid.
|
|
|
|
|
IlanTal wrote: As they say "KISS" - keep it simple, stupid.
That's Signature material there!
|
|
|
|
|
A few days ago I described a problem I had with a compiled help which ran with no problem on the local drive, but not when it was on a network drive. Nishant Sivakumar suggested it might be broken links. To test the problem I shared out a directory called “temp” on my local drive. I shared it as z:\temp. Then I put a help file, cardiac.chm which had links ONLY to existing files (i.e. no Web pages). These existing files have been compiled into the cardiac.chm file.
On the temp directory the help file worked as expected. On z:\temp it told me “Internet Explorer was unable to link to the Web page you requested”. Since all links are to internal existing files (in the help itself), there should be no broken links.
Still I don’t know what to do to fix the problem. I also tried several compiled help files and they all show the same problem. Something is different about a network drive which causes the help not to work.
Any suggestions would be appreciated.
Thanks,
Ilan
|
|
|
|
|
IlanTal wrote: Still I don’t know what to do to fix the problem.
Rest assured that the problem you’re experiencing isn’t something to do with your compiled help file. I haven’t found anything to prove this yet but I think breaking the chm file is done for security reasons (ie when not run from the local machine). I had a help file shared as well worked fine until a few months ago; then it failed to work (me thinks there was a MS update involved). I just set up my app to check the help file on the local drive against a version on the network if the network version is newer update then copy the new version up.
On a related note attempting to compile a help file on the network also fails as well.
-- modified at 2:29 Wednesday 25th January, 2006
|
|
|
|
|
You found an interesting solution in the app to check dates and download the latest version from the network. This would of course solve my problem both for the managed exe as well as the compiled help.
Both should really work from the network drive, but if they don't work around the problem by downloading the latest software from the network drive. I hadn't thought of that possibility.
Since you have already thought about the problem, do you use a bat file or did you write an exe to do the job?
Thanks,
Ilan
|
|
|
|
|
The batch file is very simple / good idea. And could be something as simple as
XCopy –d [Network path] [Local path]
The –d switch indicates to copy if the file is newer.
Type help xcopy in at the command prompt for a full list of options
First off when I responded to your question I guess I didn’t realize this was the managed forum so bear with me as there is probably a better way in Managed code
It’s really easy, I have an ini file that specifies where on the network my stuff sits. I do this from the splash screen (hey what else is it for).
->Get the path to my chm file
->Get the date modified.
CFile::GetStatus [^]
->Get the Date modified of the local file.
->Compare the two.
->Copy the files if the network one is newer.
CopyFile[^]
-- modified at 3:38 Wednesday 25th January, 2006
|
|
|
|
|
I'll use your idea of the batch file. Up until now it has been a real problem since people have to manually update to the latest file (since the LAN doesn't work) and of course they don't update.
If you have time, please look at my troubles with managed files. It is the message immediately above this one. I'd like to hear your thoughts on it.
Thanks,
Ilan
|
|
|
|