|
[求助]C 程序错误
我受不了,你代码到底是C++还是C的,似乎C语言变量必须申明在代码前,我把你代码用C编译一堆错误。好吧,我承认我技术不行,这个问题我解决不了,你就当我没回答过吧,偶去学习了 |
|
[求助]C 程序错误
你当我是没入门啊,我自学C++将近一多年了,如果连这都不知道我就去撞死了。你访问p就是空指针,你不崩溃才怪。我看你是刚入门不久的,估计连调试都不会吧,我当初也不懂调试,全凭自己一点一点尝试,在容易出错的地方多加几个输出,来定位错误的地方。我不懂 你要说什么,我想说的 NULL 和 '\0'等同,比喻你 int i=NULL; 和 int i='\0'; 最终i的值都为0,'\0'就是0的转义。我知道我表达的不清楚,也不知道你说的是不是这 |
|
[求助]C 程序错误
[QUOTE=smartdog;1081639]谢谢你的关注。 但是以下代码是没有错误的: “ while(NULL != file_name[i])//数组越界,i到了2就越界了” 我的file_name使用的是数组指针,所以file_name[i] 取的是文件名字符串的地址,不等于NULL表示的是找到二维数组的最后一个元素。 ...[/QUOTE] 呃,或许是我不理解你要做什么吧。你运行我给的代码了,我的报错了吗?另外我想说的是 NULL != *file_msg 和 '\0' != *file_msg似乎都是一样的吧,没什么区别吧? |
|
[求助]C 程序错误
呃,没看到你后面还有个逗号,偶是用C++写的没有发现错误,不知道C是不是和C++有点不同 char *file_name[] = { "test1.c", "test2.c", }; |
|
[求助]C 程序错误
楼主是故意的么 include "stdafx.h" #include<stdio.h> #include<stdlib.h> #include <string.h> int main(void) { char *file_name[3] = { "test1.c", "test2.c", }; FILE *new_fp = NULL; new_fp = fopen("newfile.txt", "w+"); if (NULL == new_fp) { printf("Crear new file error!\n"); return -1; } char *file_msg = NULL; file_msg = (char *)malloc(40960); if (NULL == file_msg) return -1; char *new_file_msg = NULL; new_file_msg = (char *)malloc(40960); if (NULL == new_file_msg) return -1; char *p_src = file_msg; char *p_dst = new_file_msg; int i = 0; while(NULL != file_name[i]) { memset(file_msg, '\0', 40960); memset(new_file_msg, '\0', 40960); FILE *fp = NULL; fp = fopen(file_name[i], "r"); if (NULL == fp) { printf("Open file :%s error!\n",file_name[i]); return -1; } fread(file_msg, 1, 4096, fp); while(NULL != *file_msg) { if (NULL == *(file_msg + 1)) break; if (('/' == *file_msg) && ('/' == *(file_msg + 1))) {/*本行后面全部为注释*/ while ('\r' != *file_msg) file_msg++; file_msg += 2; } else if (('/' == *file_msg) && ('*' == *(file_msg + 1))) {/*注释符号开始*/ file_msg += 2; while (strncmp(file_msg, "*/", 2)) file_msg++; file_msg += 2; } else if (('\r' == *file_msg) && ('\n' == *(file_msg + 1))) {/*到达行尾*/ file_msg += 2; } else {//真实有效数据 *new_file_msg = *file_msg; new_file_msg++; file_msg++; } } file_msg = p_src; new_file_msg = p_dst; fwrite(new_file_msg, strlen(new_file_msg), 1, new_fp); fclose(fp); i++; } free(new_file_msg); free(file_msg); file_msg = NULL; new_file_msg = NULL; fclose(new_fp); return 0; } 这是你的 #include "stdafx.h" #include<stdio.h> #include<stdlib.h> #include <string.h> int main(void) { char *file_name[] = { "test1.c", "test2.c", }; FILE *new_fp = NULL; new_fp = fopen("newfile.txt", "w+"); if (NULL == new_fp) { printf("Crear new file error!\n"); return -1; } char *file_msg = NULL; file_msg = (char *)malloc(40960); if (NULL == file_msg) return -1; char *new_file_msg = NULL; new_file_msg = (char *)malloc(40960); if (NULL == new_file_msg) return -1; char *p_src = file_msg; char *p_dst = new_file_msg; int i = 0; while(NULL != file_name[i])//数组越界,i到了2就越界了 { memset(file_msg, '\0', 40960); memset(new_file_msg, '\0', 40960); FILE *fp = NULL; fp = fopen(file_name[i], "r"); if (NULL == fp) { printf("Open file :%s error!\n",file_name[i]); return -1; } fread(file_msg, 1, 4096, fp); while(NULL != file_msg)// file_msg似乎永远不可能等于NULL,应该是*file_msg吧 { if (NULL == (file_msg + 1))//这儿也是* (file_msg + 1) break; if (('/' == *file_msg) && ('/' == *(file_msg + 1))) {/*本行后面全部为注释*/ while ('\r' != *file_msg) file_msg++; file_msg += 2; } else if (('/' == *file_msg) && ('*' == *(file_msg + 1))) {/*注释符号开始*/ file_msg += 2; while (!strncmp(file_msg, "*/", 2))//楼主要除掉//,应该不用加'!'吧 file_msg++; file_msg += 2; } else if (('\r' == *file_msg) && ('\n' == *(file_msg + 1)))//不知道楼主是想除掉换行符吗?如果除掉换行符应该是前面是'\n',后面是'\r'吧 {/*到达行尾*/ file_msg += 2; } else {//真实有效数据 *new_file_msg = *file_msg; new_file_msg++; file_msg++; } } file_msg = p_src; new_file_msg = p_dst; fwrite(new_file_msg, strlen(new_file_msg), 1, new_fp); fclose(fp); i++; } free(new_file_msg); free(file_msg); file_msg = NULL; new_file_msg = NULL; fclose(new_fp); return 0; } |
|
[求助]
看不懂,这个程序似乎是用网络验证,似乎是以m1或者c1开头的10位字母或数字,,感觉程序先构造连接网站的字符串,然后在某一个地方进行了网络验证,一直找不到程序是在哪里进行网络验证的 |
|
[求助]
围观下 |
|
[求助]关于PE文件的问题
其实我是想这样写的,我看了网上的自删除文件代码,结果发现做了半天,才发现CloseHandle(HANDLE(4))在xp下不行 [CODE] void main() { HMODULE hModule = NULL; TCHAR szBuf[MAX_PATH] = {0}; hModule= ::GetModuleHandle(NULL); GetModuleFileName(hModule, szBuf, MAX_PATH); JmpNewModuleExecute(); CloseHandle(HANDLE(4)); UnmapViewOfFile(hModule); DeleteFile(szBuf); } CODE] |
|
[求助]NT驱动调试代码中Kdprint输入太多,卸载驱动时蓝屏
把你代码发出来看下 |
|
[讨论]Windows7变态的安全性
似乎只有win 764位需要签名吧,32位似乎不需要 |
|
[分享]上当了,上当了,新手快来看看这高级玩意。
点击图片,右键另存为,将图片后缀名改为.exe,看见过图片保存为压缩文件的,exe的倒没看过 |
|
[分享]上当了,上当了,新手快来看看这高级玩意。
吓人的而已,有必要重启电脑吗 |
|
[求助]如何不通过dll屏蔽win键和任务管理器
我一直在想,这个程序是怎样禁用ctrl+alt+del和任务管理器的,网上查了一下,原来是把C盘下的taskmgr.exe文件给打开,使任务管理器不能执行 |
|
[求助]如何不通过dll屏蔽win键和任务管理器
楼主C++没学好,低级钩子可以放在应用程序内,键盘钩子才得用dll |
|
[建议][建议]唉 新人真的难混啊。提出的问题根本没人回答啊
新人都是这样,你怎么不回复别人的,哪怕随便说一句也行 |
|
[求助]抓取arp包问题
LZ为什么非得用winsock,winpcap多简单啊,winsock根本就不可能,你不用winpcap,除非你自己写个驱动 |
|
[原创]新手成长日志之Windbg双机调试配置
我64位Win7,Windbg双机调试老是失败,楼主可有什么方法 |
|
[原创]新手成长日志值UE与注册表
我也是新手,新手支持新手一下 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值