当前位置:主页>销售管理软件> 列表

用代码,如何把文件,用save方法保存到别的机器去。 找免费财务管理软件

仓库管理软件版1楼: 如果我把文件保存到本机,用X.save("d:\test.txt")是可以的。
如果我要保存到192.168.0.5机器上的e:\saveFie下(该文件夹没有共享),能做到吗?

2楼: 如果你有它的账号你可以保存到
\\192.168.0.5\e$\text.txt 如用友财务软件价格

3楼: 在没有共享的情况下就只能写个服务器端和客户端来实现了。

4楼: 没有权限是不能直接写的。

5楼: 如何才知道它的账号或有权限?

6楼: 应该不用你去担心是否有读写的权限吧。
判断有无写的权限,你可以试试将你欲写的网络文件夹映射到你本机作为磁盘试试,如果成功则证明有权限,否则是没有的。
熟悉磁盘映射函数么?

仓库管理软件版7楼: to dywapple:不熟哦,请指教

8楼: 同意田伯光的说法
Memo1.Lines.SaveToFile(''\\192.168.0.118\e$\11.txt'');

9楼: 不行哦
如\\192.168.0.3的e盘没有共享,则SaveToFile(''\\192.168.0.3\e$\11.txt'')出错,错误信息:...拒绝访问

10楼: 不是共享的问题。如果你用的是2000系统默认都是共享的。
你需要登陆他的机器。

11楼: 你也可以这样


if OpenDialog1.Execute then
Memo1.Lines.SaveToFile(OpenDialog1.FileName);
从网上邻居直接登陆你要找的计算机和要保存的路径

12楼: to 衣雪峰:我已经登陆了他的机器了,仍出错。
还有,我不能用下面方法的,而是要直接保存到目的端。
“if OpenDialog1.Execute then
Memo1.Lines.SaveToFile(OpenDialog1.FileName);” 如免费财务管理软件

13楼: 哪位大虾把如下这代码,帮我做成DELPHI的,跪求
//------------------------------------------------------------------------------

#include
#pragma hdrstop

#include "main.h"
//------------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmMain *frmMain;

BYTE byte_486560[0x400];

//------------------------------------------------------------------------------
__fastcall TfrmMain::TfrmMain(TComponent* Owner)
: TForm(Owner)
{
}
//------------------------------------------------------------------------------



bool TfrmMain::DataToBmp(void* pbyData)
{
if (NULL == pbyData)
{
return false;
}

asm
{
mov ecx, pbyData
xor esi, esi

loc_40E46D:
mov eax, esi
and eax, 80000001h
jns short loc_40E47B

dec eax
or eax, 0FFFFFFFEh
inc eax

loc_40E47B:
jnz short loc_40E49B

xor eax, eax

loc_40E47F:
mov dl, [ecx+eax]
mov byte_486560[eax], dl
mov bl, [ecx+eax]
xor bl, 68h
mov [ecx+eax], bl
inc eax
cmp eax, 400h
jl short loc_40E47F


jmp short loc_40E4B3


loc_40E49B:
xor eax, eax

loc_40E49D:
mov dl, byte_486560[eax]
mov bl, [ecx+eax]
xor bl, dl
mov [ecx+eax], bl
inc eax
cmp eax, 400h
jl short loc_40E49D


loc_40E4B3:
inc esi
add ecx, 400h
cmp esi, 14h
jl short loc_40E46D
}

return true;

}

//------------------------------------------------------------------------------
bool TfrmMain::BmpToData(void* pbyData)
{
if (NULL == pbyData)
{
return false;
}

asm
{
mov ecx, pbyData
xor esi, esi

loc_40E46D:
mov eax, esi
and eax, 80000001h
jns short loc_40E47B

dec eax
or eax, 0FFFFFFFEh
inc eax

loc_40E47B:
jnz short loc_40E49B

xor eax, eax

loc_40E47F:
mov bl, [ecx+eax]
xor bl, 68h
mov [ecx+eax], bl
mov byte_486560[eax], bl
inc eax
cmp eax, 400h
jl short loc_40E47F

jmp short loc_40E4B3


loc_40E49B:
xor eax, eax

loc_40E49D:
mov dl, byte_486560[eax]
mov bl, [ecx+eax]
xor bl, dl
mov [ecx+eax], bl
inc eax
cmp eax, 400h
jl short loc_40E49D


loc_40E4B3:
inc esi
add ecx, 400h
cmp esi, 14h
jl short loc_40E46D
}

return true;

}

//------------------------------------------------------------------------------
void __fastcall TfrmMain::btnOpenClick(TObject *Sender)
{
oDlg->FilterIndex = 0;

if (false == oDlg->Execute())
{
return;
}

TMemoryStream* pStream;
String sFileName;
int iFileHandle;
int iSize;

sFileName = oDlg->FileName;
if (false == FileExists(sFileName))
{
return;
}

iFileHandle = FileOpen(sFileName, fmOpenRead);
iSize = GetFileSize ((void*)iFileHandle, NULL);
FileClose(iFileHandle);
if (iSize < 20480)
{
MessageBox(Handle, lblWarning->Caption.c_str(), "警告", MB_ICONWARNING);
return;
}

if (1 == oDlg->FilterIndex)
{
img->Picture->LoadFromFile(oDlg->FileName);
}
else
{
pStream = new TMemoryStream();
pStream->LoadFromFile(oDlg->FileName);

if (false == DataToBmp(pStream->Memory))
{
return;
}

//显示
img->Picture->Bitmap->LoadFromStream(pStream);
delete pStream;
}

btnSaveData->Enabled = true;
btnSaveBmp->Enabled = true;
lblWidth->Caption = IntToStr(img->Picture->Bitmap->Width);
lblHeight->Caption = IntToStr(img->Picture->Bitmap->Height);
}
//------------------------------------------------------------------------------
void __fastcall TfrmMain::chbStretchClick(TObject *Sender)
{
img->Stretch = chbStretch->Checked;
}
//------------------------------------------------------------------------------

void __fastcall TfrmMain::btnSaveBmpClick(TObject *Sender)
{
sDlg->Filter = "位图文件(*.bmp)|*.bmp|(*.*)|*.*";
sDlg->DefaultExt = "*.bmp";

if (false == sDlg->Execute())
{
return;
}

img->Picture->Bitmap->SaveToFile(sDlg->FileName);
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::btnSaveDataClick(TObject *Sender)
{
sDlg->Filter = "数据文件(*.dat)|*.dat";
sDlg->DefaultExt = "*.dat";

if (false == sDlg->Execute())
{
return;
}


TMemoryStream* pStream;
String sFileName;

sFileName = sDlg->FileName;

pStream = new TMemoryStream();
img->Picture->Bitmap->SaveToStream(pStream);
if (false == BmpToData(pStream->Memory))
{
return;
}

pStream->SaveToFile(sFileName);
delete pStream;
}
//---------------------------------------------------------------------------

仓库管理软件版14楼: 大过年的,不用这样吧?谁有红包可以顶一下。[:D]