有那位大蝦,能幫我對這個簡單的程序,加一個簡單的功能?在下感激不盡!

PIAOMAN 2001-08-03 10:02:55
#include <wincon.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#pragma comment(lib,"netapi32")
typedef struct _ASTAT_
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
}ASTAT, * PASTAT;

ASTAT Adapter;

void main (void)
{
NCB Ncb;
UCHAR uRetCode;
LANA_ENUM lenum;
int i;

memset( &Ncb, 0, sizeof(Ncb) );
Ncb.ncb_command = NCBENUM;
Ncb.ncb_buffer = (UCHAR *)&lenum;
Ncb.ncb_length = sizeof(lenum);
uRetCode = Netbios( &Ncb );
printf( "The NCBENUM return code is: 0x%x \n", uRetCode );

for(i=0; i < lenum.length ;i++)
{
memset( &Ncb, 0, sizeof(Ncb) );
Ncb.ncb_command = NCBRESET;
Ncb.ncb_lana_num = lenum.lana[i];

uRetCode = Netbios( &Ncb );
printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
lenum.lana[i], uRetCode );

memset( &Ncb, 0, sizeof (Ncb) );
Ncb.ncb_command = NCBASTAT;
Ncb.ncb_lana_num = lenum.lana[i];

strcpy((char *)&Ncb.ncb_callname,"* ");
Ncb.ncb_buffer = (unsigned char *) &Adapter;
Ncb.ncb_length = sizeof(Adapter);

uRetCode = Netbios( &Ncb );
printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
lenum.lana[i], uRetCode );
if ( uRetCode == 0 )
{
printf("The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
lenum.lana[i],
Adapter.adapt.adapter_address[0],
Adapter.adapt.adapter_address[1],
Adapter.adapt.adapter_address[2],
Adapter.adapt.adapter_address[3],
Adapter.adapt.adapter_address[4],
Adapter.adapt.adapter_address[5]);
}
}
}
----------------------------------------------------------------------
1)已有功能描述
該程序,用運行節果是生成網卡號,直接輸出到屏幕上,
2)想要加的功能:
想把運行節果,生成一個txt文件

各位大蝦小第實在太菜,幫幫我吧!等小弟把這 project 做完(用lisp寫的).
一定把vc學好
sisina!!!
...全文
26 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
PIAOMAN 2001-08-03
有哪位大俠可以幫忙?!
回复
Kevin_qing 2001-08-03
编译完成后叫a.exe
运行a >result.txt

嘿嘿
回复
lllllll 2001-08-03
if ( uRetCode == 0 )
{
FILE * fp;
fp=fopen("mac.txt","wt");
fprintf(fp,"The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
lenum.lana[i],
Adapter.adapt.adapter_address[0],
Adapter.adapt.adapter_address[1],
Adapter.adapt.adapter_address[2],
Adapter.adapt.adapter_address[3],
Adapter.adapt.adapter_address[4],
Adapter.adapt.adapter_address[5]);
fclose(fp);
}
回复
相关推荐
发帖
非技术类
创建于2007-09-28

1624

社区成员

VC/MFC 非技术类
申请成为版主
帖子事件
创建了帖子
2001-08-03 10:02
社区公告
暂无公告