由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - How to use openFileDialog() to save a binary file in .net C++
相关主题
a question about C++.net class libraryopen an image file
[合集] 问一个Response.WriteFile的问题关于多线程锁:锁代码还是锁资源?
C#的new在method declaration里有和没有有啥区别么[合集] visual c++中读二进制图形文件的奇怪问题
包子题: Implement GetFullPathOfIsolatedFileC 中的typedef 一问
Windows filesystem bugRe: [转载] how would you do this?
WebClient is not thread-safe!这个python code能否优化去掉file write
LinqPad is handystreamwriter and filestream
How not to read comment lines from a text fileMPI Write?
相关话题的讨论汇总
话题: c++话题: fid
进入DotNet版参与讨论
1 (共1页)
q*****z
发帖数: 191
1
Hi,
I am new to .net but have used c for years. I met a problem recently using .
net C++. What I want to do is to use openFileDialog() to open a file and
write some binary information to it. Here is what I have:
SaveFileDialog^ d = gcnew SaveFileDialog;
d->Filter = "exp files (*.exp)|*.exp";
if (d->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
FILE *fid;
fopen(fid,d->FileName,'wb+');
fwrite(buf,1,frameSize,fid);
fclose(fid);
}
It seems like d->Filename does't return the standard st
l*s
发帖数: 783
2
MSDN上的code不work?
private:
void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
Stream^ myStream;
SaveFileDialog^ saveFileDialog1 = gcnew SaveFileDialog;
saveFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*
";
saveFileDialog1->FilterIndex = 2;
saveFileDialog1->RestoreDirectory = true;
if ( saveFileDialog1->ShowDialog() == ::DialogResult::OK )
{
if ( (myStream = saveFileDialog1->OpenFile()) != nullptr )


【在 q*****z 的大作中提到】
: Hi,
: I am new to .net but have used c for years. I met a problem recently using .
: net C++. What I want to do is to use openFileDialog() to open a file and
: write some binary information to it. Here is what I have:
: SaveFileDialog^ d = gcnew SaveFileDialog;
: d->Filter = "exp files (*.exp)|*.exp";
: if (d->ShowDialog() == System::Windows::Forms::DialogResult::OK)
: {
: FILE *fid;
: fopen(fid,d->FileName,'wb+');

q*****z
发帖数: 191
3
Thanks a lot! I did try but since I am new to the managed coding style I
have no clue what is happening.
The following line has error:
myStream->Write(buf,0,frameSize);
error C2664: 'System::IO::Stream::Write' : cannot convert parameter 1 from
'unsigned char *' to 'cli::array ^'
q*****z
发帖数: 191
4
Thanks a lot! I did try but since I am new to the managed coding style I
have no clue what is happening.
The following line has error:
myStream->Write(buf,0,frameSize);
error C2664: 'System::IO::Stream::Write' : cannot convert parameter 1 from
'unsigned char *' to 'cli::array ^'
t*******y
发帖数: 81
5
buf is native type unsigned char*, here you need managed type array.

from

【在 q*****z 的大作中提到】
: Thanks a lot! I did try but since I am new to the managed coding style I
: have no clue what is happening.
: The following line has error:
: myStream->Write(buf,0,frameSize);
: error C2664: 'System::IO::Stream::Write' : cannot convert parameter 1 from
: 'unsigned char *' to 'cli::array ^'

1 (共1页)
进入DotNet版参与讨论
相关主题
MPI Write?Windows filesystem bug
关于文件输出,请教大家?WebClient is not thread-safe!
bloomberg测试题,失败阿LinqPad is handy
Re: how to write a string to a new fileHow not to read comment lines from a text file
a question about C++.net class libraryopen an image file
[合集] 问一个Response.WriteFile的问题关于多线程锁:锁代码还是锁资源?
C#的new在method declaration里有和没有有啥区别么[合集] visual c++中读二进制图形文件的奇怪问题
包子题: Implement GetFullPathOfIsolatedFileC 中的typedef 一问
相关话题的讨论汇总
话题: c++话题: fid