Segematation fault 的问题

以下代码是我在练习switch语句时在DEV C++里写的时候调试会出现segematation fault
但是同样的在VS2017中却不会出现这个问题,求教!(抱拳)

#include <stdio.h>
int main()
{
    char ch;
    printf("please input A or B or C or D or E ");
    scanf("%c",&ch);
    switch(ch>='A'&&ch<='E')
    {
        case 0: 
              switch(ch){
                          case 'A':printf("perfect");
                          case 'B':printf("good");
                          case 'C':printf("good");
                          case 'D':printf("pass");
                          case 'E':printf("pass");
                       }
        case 1:
              if(ch>'E'&&ch<='Z')
                   printf("not pass");
              else printf("input fault");   

    }
    return 0;

} 

1个回答

你会用switch么?你确定你会用switch么?你真的确定你会用switch么?

...
scanf("%c",&ch);
switch(ch)
{
                          case 'A':printf("perfect"); break;
                          case 'B':printf("good"); break;
                          case 'C':printf("good"); break;
                          case 'D':printf("pass"); break;
                          case 'E':printf("pass"); break;
                                                    default: 
                                                    if(ch>'E'&&ch<='Z') 
                                                       printf("not pass");
              else printf("input fault");               
}
...
qq_43516599
goog 楽 还敢问我哪里用错了?求指教
9 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
关于segmentation fault的问题
本程序意在实现一个扫描软件rn现在的问题是用gdb调试,一旦退出这个函数就发生segmentation error,怀疑发生了栈溢出,但是觉得不太可能)rn原函数大致是这样的(被main调用)rnextern Option o;rnint PTM_main(int argc, char *argv[])rn rn char *p;rn char *host_spec;rn int i, arg;rn int num_host_exp_groups = 0;rn int numhosts_scanned = 0;rn int numhosts_up = 0;rn char *normalfilename = NULL;rn char **host_exp_group;rn struct scan_lists *ports = NULL;rn time_t timep;rn char mytime[128];rn HostGroupState *hstate;rn Target *currenths;rn。。。。。rn host_exp_group = (char **) safe_malloc(o.host_group_sz * sizeof(char *));rn rn while(1)rn while(num_host_exp_groups < o.host_group_sz &&rn (host_spec = grab_next_host_spec(argc, argv))) rn host_exp_group[num_host_exp_groups++] = strdup(host_spec);rn rn if (num_host_exp_groups == 0)rn break;rn hstate = new HostGroupState(o.host_group_sz,0,host_exp_group, num_host_exp_groups);rn //========================================================================== rn while(currenths = nexthost(hstate, &(o.pingtype))) rn numhosts_scanned++; rn rn if (currenths->flags & HOST_UP ) rn numhosts_up++;rnrn delete currenths;rn rn //=========================================================================rn rnrn delete hstate;rn // Free my host expressions rn for(i=0; i < num_host_exp_groups; i++)rn free(host_exp_group[i]);rn num_host_exp_groups = 0;rn rn rn free(host_exp_group);rn return 0rnrnrn只要把中间==中间这段删掉就没问题了,但是实在没想通为什么不在==里面就发生错误,而要到return以后才出问题,请高手帮忙
malloc and segment fault 问题
我的代码中有一个 unsigned char *array[20000]rn在一个不到20000行的文件中解析数据rn每一行数据存在用malloc函数所获取的堆内存空间中rn然后将堆内存里指针放在array中rnrn在程序运行过程中rn根据打印结果rn前面几十行数据没有任何问题rn可以正确的解析rn但在解析某一行时rnmalloc函数发生段错误rnsegment faultrn要解析的文件没有问题rn我不知道是怎么回事情rnrnlinux debian gcc
segmentation fault的问题
从网上下了个输入法的源码imframe,编译运行后界面显示出来了,但是点击键盘按钮的时候系统console输出 segmentation fault。rnrn于是我自己写了个输入法的demo,调用QWSInputMethod的sendcommitstring方法提交字符到编辑框上时也报了segmentation fault的问题。rnrn各位有遇到过这样的提示么?这是什么原因导致的?rn困扰好几天了,没有进展,网上有说是系统字体的问题,但是我确认不是字体的问题。rn
Segmentation fault问题
//c语言实现输入任意长度的字符串n#include n#include nint main (void )nnchar *string = NULL ,*temp = NULL;nchar ch;nint i;n//先将字符串初始化为空nstring = (char *)malloc(1);nstring[0] = '\0';n//len为实际长度(包括空字符)nint len = 1;nwhile ((ch = getchar())!= '\n')nn //申请一个新字符串n temp = (char *)malloc(len+1);n if (temp = NULL)n n printf("内存不足!");n free(string);n exit(0);n n i=0;n while (string[i] != '\0'&&i
Segmentation fault 问题
在linux下发现问题如下:rn 求出数组中的最大值,并打印最大值的下标:rn#includern#define M 4rnrnint fun(int *a, int *n, int pos[]) rn rn int i, k, max = -32768 ;rn for(i=0; imax)rn max = a[i];rn rn for(i=0; i < M; i ++)rn rn if( a[i]==max ) rn pos[k++]=i;rn rn *n=k; rn return max; rn rnrnrnmain()rnrn int a[M] ,p[M] ,i = 0 , j , n;rn rn printf("Enter 4 number:\n");rn for(i = 0;i < M; i++)rn rn scanf("%d",a+i);rn rn j = fun(a ,&n , p);rn printf("The max num is: %d\n",j);rn for(i = 0;i< n;i++)rn rn printf("4%d",p[i]);rn rn printf("\n");rn rnrnrn用 gcc -o sort1 sort1.c编译后,出现Segmentation fault错误,求救了!!!
关于Segmentation fault的问题
是关于一个多边形求面积的程序,编译都通过了,可是最后运行时出现了Segmentation fault的问题,不知道问题出在哪里,请大家帮忙!rnrn程序所示如下(共七个文件):rnrnrn1. circle.hpp:rnrn#ifndef CIRCLE_HPPrn#define CIRCLE_HPPrn#include rn#include "shape.hpp"rnrnrnclass circle: public shape rnrnprivate:rnrn double radius;rn double cx, cy; // Circle central coordinate;rnrnprotected:rnrnpublic:rnrn //default constructor;rnrn circle():shape()rnrn cx = 0;rn cy = 0;rn radius = 0;rnrn rnrn //constructor;rnrn circle(double r, double x, double y) : shape()rnrn cx = x;rn cy = y;rn radius = r;rn rnrnrnrn virtual int point_inclusion_test(double x, double y)rn rn double length = pow(pow(x,2) + pow(y,2),0.5);rn if(length <= radius)rn return 1;rn elsern return 0;rnrn rnrnrn virtual double compute_area(double tol)rnrn double area = M_PI * radius * radius;rnrn return area;rnrn rnrn;rnrnrn#endifrnrnrn2. edge.hpp:rnrnrn#ifndef EDGE_HPPrn#define EDGE_HPPrnrnclass edgernrnpublic:rn point initial;rn point terminal;rn;rnrnrn#endifrnrn3. point.hpp:rn#ifndef POINT_HPPrn#define POINT_HPPrnrnclass pointrnrnpublic:rnrn double x;rn double y;rn;rnrn#endifrnrn4. polygon.hpp:rn#ifndef POLYGON_HPPrn#define POLYGON_HPPrn#include "shape.hpp"rn#include "point.hpp"rn#include "edge.hpp"rnrn#include rn#include rn#include rnrn#include rn#include rn#include rnrnrn/* Constant used to help scan in lines */rn#define MAXLINELENGTH 100rnrnclass polygon : public shapernrnprivate:rnrn int num_vertices;rn int num_edges;rn int poly_edges;rn point* vertices;rn edge* edges;rn int* list_edges;rn point* interior_pnt;rnrnrnrnprotected:rnrnrnpublic:rnrn //default constructor:rn polygon();rnrn // constructor:rn polygon(char filename[]);rn rnrn /* Dynamically adds a vertex to the polygon struct */rn void polygon_add_vertex(int index, double hori, double vert);rnrn /* Reads the coordinates of a vertex */ rnrn point polygon_get_vertex(int index);rnrn /* Dynamically adds an edge to the polygon struct */rn void polygon_add_edge(int index, int vertex1, int vertex2);rnrn /* Reads the vertex numbers that form an edge. */rn edge polygon_get_edge(int index);rnrn /* Dynamically adds an edge number to the polygon description */rn void polygon_add_poly_edge(int index, int edge_num);rnrn /* Reads an edge number from the polygon description */rn int polygon_get_poly_edge(int index);rn rn /* Reads the number of vertices in the polygon */rn int polygon_get_num_vertices();rnrn /* Reads the number of edges in the polygon */rn int polygon_get_num_edges();rnrn /* Defines the coordinates of a point inside the polygon */rn void polygon_set_interior_point(double x, double y);rnrn virtual int point_inclusion_test(double x, double y);rnrnrn;rnrnrn#endifrnrn5. polygon.cpprn#include"polygon.hpp"rnrnrn// default constructor:rnpolygon::polygon(): shape()rnrnrn num_vertices = 0;rn vertices = 0;rn num_edges = 0;rn edges = 0;rn poly_edges = 0;rn list_edges = 0;rn interior_pnt = 0;rnrnrnrn/* Sets up a polygon with data given in the .poly file format */rnpolygon::polygon(char filename[]):shape()rnrn char garbage[MAXLINELENGTH]; /* Unnecessary strings from file */rn int index;rn double *xCoord, *yCoord;rn int *vertex1, *vertex2, *edge_num;rn double int_xCoord, int_yCoord;rnrn /* Try to open file */rn FILE* data = fopen(filename, "r");rn rn /* Make sure file opened */rn if(data == NULL)rn rn printf("Error opening %s!", filename);rn exit(-1);rn rnrn /* Read in first line from file */rn fgets(garbage, MAXLINELENGTH, data);rnrn /* Scan in the number of vertices */rn fgets(garbage, MAXLINELENGTH, data);rn fscanf(data, "%d", &num_vertices);rn fgets(garbage, MAXLINELENGTH, data);rnrn /* Scan in the vertex descriptions */rn fgets(garbage, MAXLINELENGTH, data);rn xCoord = (double*) calloc(num_vertices, sizeof(double));rn yCoord = (double*) calloc(num_vertices, sizeof(double)); rn for(int i=0; i 0)rn sign = 1;rn elsern sign = -1;rnrn side1 = pow(pow(x-x1,2) + pow(y-y1,2),0.5);rn side2 = pow(pow(x2,2) + pow(y2,2),0.5);rn side3 = pow(pow(x1-y1,2) + pow(x2-y2,2),0.5);rn // Using triangle's rule to calculate theta;rn double costheta = (pow(side3,2) - pow(side2,2) - pow(side1,2))/(2*side1*side2);rn theta = acos(costheta) * sign + theta;rn rnrn //The last edge;rn double x1 = vertices[num_vertices-1].x;rn double x2 = vertices[0].x;rn double y1 = vertices[num_vertices-1].y;rn double y2 = vertices[0].y;rnrn if((x-x1) * (y-y2)-(x-x2) * (y-y1) > 0)rn sign = 1;rn elsern sign = -1;rnrn side1 = pow(pow(x-x1,2) + pow(y-y1,2),0.5);rn side2 = pow(pow(x2,2) + pow(y2,2),0.5);rn side3 = pow(pow(x1-y1,2) + pow(x2-y2,2),0.5);rn // Using triangle's rule to calculate theta;rn double costheta = (pow(side3,2) - pow(side2,2) - pow(side1,2))/(2*side1*side2);rn theta = acos(costheta) * sign + theta; rn rnrn // If point is inside the polygon, the theta should be equal to 2PI, otherwise it should be less than PIrn if(theta <= M_PI )rn return 0;rn elsern return 1;rnrnrn6. shape.hpprn#includernrn#ifndef SHAPE_HPPrn#define SHAPE_HPPrnrnclass shapernrnprivate:rnrnprotected:rnrnpublic:rnrn // default constructorrn shape()rnrn // virtual point inclusion test functionrn virtual int point_inclusion_test(double x, double y) = 0;rnrn // virtual Monte Carlo Sampling function;rn virtual double compute_area(double tol) rn double xbound = 1.0;rn double ybound = 1.0;rnrn // record for if the random point is included in the shape;rn int MTrecord = 0;rn int N = (int)(1.0/(tol * tol));rn printf("a=",N);rn double test_x;rn double test_y;rnrn for(int i = 1; i<=N; i++)rn rn test_x = drand48() * xbound;rn test_y = drand48() * ybound;rn if(point_inclusion_test(test_x,test_y) == 1)rn MTrecord++;rn rn //Compute the area of the shape;rnrn double area = (double)(MTrecord/N) * (xbound*ybound);rnrn return area;rn rnrnrn;rnrnrn#endifrnrnrn7. main.cpprnrn#include rn#include rn#include rnrnrn#include "circle.hpp"rn#include "polygon.hpp"rn#include "polygon.cpp"rnrnusing namespace std;rnrnint main()rn rn // construct circle rn double radius = 5., centerx = -1., centery = 1.;rn circle C(radius, centerx, centery);rn rn // compute area exactly for circlern cout << " circle has area " << C.compute_area(0.) << endl;rn rn // test inclusion functionrn double x = 0.5, y = 0.1;rn if(C.point_inclusion_test(x,y) == 1)rn cout << "( " << x << "," << y << ") is in the circle " << endl;rn elsern cout << "( " << x << "," << y << ") is not in the circle " << endl;rn rn // construct polygonrn polygon P("polygon2.poly");rn rn // compute area approximately for polygonrn double tol = 1e-3;rn cout << " polygon has (approximate) area " << P.compute_area(tol) << endl;rn rn // test inclusion functionrn if(P.point_inclusion_test(x,y) == 1)rn cout << "( " << x << "," << y << ") is in the polygon " << endl;rn elsern cout << "( " << x << "," << y << ") is not in the polygon " << endl;rnrn return 0;rnrnrn经过检查,很可能问题是出在5.polygon.cpp的构造函数polygon::polygon(char filename[])中。请各位帮忙看看,具体错误是出在哪儿?
segmentation fault的问题,急!
我用VI写个单链表,然后用gcc编译:rn[code=C/C++][/code]#includern#includern#define OK 1rntypedef struct Nodernrn int num;rn char name[10];rn struct Node *next;rnStud,*studp;rnrnStud *CreatStudLink(studp h)rnrn if((h=(studp)malloc(sizeof(Stud)))==NULL)rn rn printf("Error!\n");rn exit(0);rn rn h->next=NULL;rn return h;rnrnrnrnStud *InsertStudData(studp h)rnrn int n,i;rn studp p,s;rn p=h;rn printf("input the amount of student\n");rn scanf("%d",&n);rn for(i=0;inum);rn printf("input name\n");rn scanf("%s",p->name);rn p->next=s;rn p=s;rn rnreturn h;rnrnrnStud *SearchStudData(studp h)rnrn int n;rn studp p;rn p=h;rn printf("input a student's number and output the data\n");rn scanf("%d",&n);rn while(n!=p->num)rn rn p=p->next;rn rn printf("num:%d\t",p->num);rn printf("num:%s\n",p->name);rnreturn h;rnrnrnvoid main()rnrn studp stu;rn CreatStudLink(stu);rn InsertStudData(stu);rn SearchStudData(stu);rn free(stu);rnrnrn屏幕按我的要求显示了"input num"rn我输入了一个字之后提示我 segmentation fault。什么意思?
关于 Memery fault的问题
我的程序在 red hat系统下编译,运行都没问题rn但是放到 AIX系统下 编译可以通过,但是运行时出现runMyProg: 21097 Memory fault(coredump) 的问题rn请高手指教!
segmentation fault问题
我希望在出现segmentation fault错误时重启机器,怎么实现?谢了!
segmentation fault!!!
下面是我写的一个将一定长以内的十进制转换为十六进制的程序,基本的思想就是模拟手动转换的过程。不断地除以十六(下一次以商进行),得商和余数,把余数悉数存入一个数组,然后逆序输出。结果输出是正确的,可是在linux下运行最后报segmentation fault,在windows下运行显示结果后就似乎停不下了,而且CPU100%。尤其数很大的时候,似乎是动态内存处理的问题,可我就是看不出来问题在哪。哪位帮忙看看。谢谢。rnrn#include "iostream"rnusing namespace std;rnint residue(int *,char *,int,int);rnint main(void)rnrn int n,i,l=0,c,j;rn char **p;rn cin>>n;rn int *r=new int[n];rn p=new char *[n];rn for(i=0;i>p[i];rn rn for(i=0;i=0)//逆序输出rn rn if(r[c]<10)//十六进制,如果小于10,直接输出rn rn cout<=16)?(l--,t):(l-=2,flag++,t*10+p[2]);//像173,前两位够除以16,就拿17除,这时下一步要处理的是2,从0开始计数就是第二位;像1525,前两位15不够,加上第三位2再除。这时下一步要处理的就是5,第三位。rn for(j=0;j
Segmentation fault
[size=10px] char *bufferA = (char*)malloc( 100* sizeof(char) );rn rnrn .......rnrn bufferA 被字符填充...略过rnrn .........rnrn [color=#FF0000]char *bufferB = (char*)malloc( 100* sizeof(char) );rn char *temp = (char*)malloc( 10 * sizeof(char) );rn strcpy(bufferB , bufferA ); rn sprintf(temp , "%d", 159);[/color]rnrn问题:出现Segmentation fault[/size]rn
Segmentation fault~~
~_~ 終於做好了我的my_printf, 但是當我在main裡這樣輸入的話 :rn#include rn#include "my_printf.h"rnrnint main()rnrn my_printf("%s\n", 'c');rn //printf("%s", 'c'); rn return (0);rnrnrn就 Segmentation fault,rn我知到%s对应的应该是个字组, 但是有什麽办法预防呢?
segmentation fault
#includern#includernrnvoid f(char *buff,int len)rnrn printf("%s\n",buff);rn int i;rn for(i=0;i
fault tolerance
fault tolerance in computer system design
Segmentation Fault
#includern#includern#includern#includern#includernusing namespace std;rnrnstruct Listrnrn List *prev;rn List *next;rn string name;rn friend bool operator < (List a, List b)rn rn return a.name>n)rn rn map_m;rn map::iterator it;rn List *_l, *Head;rn Head = new List;rn _l = new List;rn _l->name = "Last";rn _l->next = NULL;rn _l->prev = Head;rn Head->next=_l;rn Head->name = "Head";rn for(int i=0; i>tmp;rn if(tmp == "new")rn rnrn cin>>tmp;rn List *_l_tmp;rn _l_tmp = new List;rn _l_tmp->name = tmp;rn rn rn _l_tmp->next = Head->next;rn _l_tmp->prev = Head;rn Head->next = _l_tmp;rn _l_tmp->next->prev = _l_tmp;rn _m.insert(map::value_type(_l_tmp->name, _l_tmp));rn rn else if(tmp == "reply")rn rn cin>>tmp;rn it = _m.find(tmp);rn rn List *Prev, *Next;rnrn rn Prev = it->second->prev;rn Next = it->second->next;rnrn if(Prev != NULL && Next != NULL)rn rn Prev->next = Next;rn Next->prev = Prev;rn rn rn it->second->next = Head->next;rn it->second->prev = Head;rn Head->next = it->second;rn it->second->next->prev = it->second;rn rn else if(tmp == "tag")rn rn cin>>tmp;rn it = _m.find(tmp);rn rn List *Prev, *Next;rn rn Prev = it->second->prev; rn Next = it->second->next;rn rn Prev->next = Next;rn Next->prev = Prev;rn rn it->second->next = it->second->prev = NULL;rn rnrn rn else if(tmp == "search")rn rn List *q;rn q = Head->next;rn int Sum=0;rn while(q->next != NULL)rn rn cout<name<= 100) break;rn q = q->next;rn rn cout<<"###"<
stack fault
各位大侠,请问这是什么错误,我运行了一段代码,编译的时候没错但是在运行的时候不能运行,提示:ABC caused a Stack Fault in module ABC.exe at 0001.0177.ABC是文件名,请大家帮我指点一下,谢谢!
error 和 fault?????????????
我们公司在按照老外的要求提交一份软件需求文档说明书(Software Requirements Specification),在老外的需求导则中有这两点要求:rn -error and interrupt handlingrn -fault detection, tolerance, and recovery characteristicsrn这两条到底指的是什么?rn另外补充一点,我们公司的软件是针对自己的单片机开发的单片机软件。rn各位帮忙,万分感谢,百分相送!
Fault injection
A detailed description of fault injection testingtechnology
my fault?
if (Session["user"].ToString()=="")rn rn return;rn rn Session["user"]=Session.SessionID;rn错误提示:未将对象引用设置到对象的实例.rn rnrnhelp!
Segmentation fault???
在程序运行的时候,出现这种错误,什么意思。rn为什么在编译的时候没有出现??rn下面的程序为什么会出现这种错误。rnrn#include rnmain()rnrnchar string[100];rnint seconds=1000;rnchar *string_change;rnchar *string_last;rnrnsprintf(string,"%d",seconds);rnstring_change=&string[0];rnprintf("string_change is %s\n",string_change);rnstrcat(string_last,string_change); //程序走到这就出现 Segmentation fault 的错误。郁闷!!!rnprintf("string_last is %s\n",string_last); rnrnrnrn如上的错误是否可以避免,如何去做,真心求教!!!rn顺便说一下。我是用gcc去编译的。rn晕死。这种错误时常出现,我一直都没有将其解决。。。。rn每次运行的时候见到这几个字,都想把它给吃了。。。
Segmentation fault?
#include rn#include rn#include rnvoid mythread(void) /* 定义新线程运行的函数 */rnrn int i,ret;rn ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); /* 设置线程的取消状态 */rn if(ret != 0)rn rn printf("Thread pthread_setcancelsate failed."); /* 如果取消状态未设置成功,打印错误信息 */rn exit(1);rn rn ret = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); /* 设置线程的取消类型 */rn if(ret != 0)rn rn printf("Thread pthread_setcanceltype failed."); /* 如果取消类型未设置成功,打印错误信息 */rn exit(1);rn rn for(i=0; i<10; i++) /* 连续输出字符串,同时显示运行位置 */rn rn printf("Thread is running (%d) ...\n",i);rn sleep(1);rn rn pthread_exit("Thank you for the CPU time.\n"); /* 终止当前线程 */rnrnint main(void)rnrn pthread_t id; /* 定义线程的标识符 */rn int i, ret;rn void *thread_retult; /* 定义指针,用来存储线程的返回值 */rn ret = pthread_create(&id, NULL, (void *)mythread, NULL); /* 创建新的线程 */rn if(ret != 0)rn rn printf("Create pthread error.\n"); /* 如果线程创建失败,打印错误信息 */rn exit(1);rn rn sleep(3);rn printf("Canceling thread ...\n");rn ret = pthread_cancel(id); /* 取消新建线程 */rn if(ret != 0)rn rn printf("Thread cancelation failed.\n"); /* 如果线程取消失败,打印错误信息 */rn exit(1);rn rn sleep(2); rn /* 主线程阻塞,等待新建线程返回,并将返回值存储在前面定义的thread_result之中 */rn pthread_join(id,&thread_retult);rn printf("Thread joined, it returned: %s", (char *)thread_result); /* 输出线程返回的字符串 */rn return 0;rnrnrnrn经过编译后运行出现:rnrnThread is running(0)...rnThread is running(1)...rnThread is running(2)...rnCanceling thread....rnSegmentation faultrnrn[b]下面是我的想法:[/b]rn我觉得“新进程”终止时如果调用的是:rnpthread_exit("Thank you for the CPU time.\n"); /* 终止当前线程 */rn那么执行:rnpthread_join(id,&thread_retult);rn后自然把返回的字符串传递给thread_retult指针,但是此例程调用的是:rnret = pthread_cancel(id); /* 取消新建线程 */rn也就是说进程结束时并没有执行:rnpthread_exit("Thank you for the CPU time.\n"); /* 终止当前线程 */rn所以thread_retult指针是有问题的!rnrn经过测试,进程是被正常取消的了,只要输出不是(char *)thread_result,都能正常输出。rnrn但是具体什么问题,如何解决并不知道!同时也不知道自己理解的对不对!本人纯菜鸟一枚,求大神指教!
soap Fault
java 写的一个rpc方式的soap 出错了rnjava.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException; nested exception is: rn javax.xml.rpc.soap.SOAPFaultException javax.xml.rpc.soap.SOAPFaultException at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:498) at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:360) at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:244) at cainterface.generated.CaInterfaceSesBeanPort_Stub.existNsridAssignid(Unknown Source) at cainterface.Client.example(Client.java:40) at cainterface.Client.main(Client.java:28)rn帮忙看看什么原因?怎么解决?
segment fault
有个问题困扰小弟很久,所以特来请教各位大虾!rn本人利用ATTOL(一种脚本,执行时先预编译成C++代码)写了程序,结果在运行的过程中出现了所谓的SIG 11,后面跟了一串数字,在网上一搜索后提示为SEGMENT FAULT, 不知道该如何处理。rn小弟的程序中有比较大的嵌套结构体,使用了指针来指向结构体,来在程序中调用,不知道跟这个有没有关系,请各位大虾不吝赐教,万分感激了!!
fault反思
1.fault、error、failure    (1)程序员看到缺陷代码,确认这就是fault,很难。    (2)程序员启用断点调试时,确认错误状态(error),难。    (3)测试人员通过正确的规格文档和输出的对比,确认这就是failure,简单。2.fault    (1)修复定义fault?    (2)测试定义fault?    (3)fault之间相互干扰,导致failure…...
Linux 下,huffman_tree的Segmentation fault问题.
[code=C/C++]#include rn#include rn#include rnrn#define OK 1rn#define ERROR 0rn#define false 0rn#define OVERFLOW -2rn#define MAX 100rn#define INT_MAX ((int)(~0U >> 1))rnrn#define SCAN_INT(x, y); if (scanf("%d", &x) != EOF) while ((y = getchar()) != '\n' && y != EOF) ;rnrn#define SCAN_CHAR(x, y); if (scanf("%c", &x) != EOF) while ((y = getchar()) != '\n' && y != EOF) ;rnrntypedef struct huffman_tree_node rn unsigned int weight;rn unsigned int parent, lchild, rchild;rn huffman_tree_node, * huffman_tree;rnrntypedef char **huffman_code;rnrntypedef int status;rnrnstatus get_child (huffman_tree HT, int n, int * c1, int * c2) rn int i, m, min, temp;rnrn m = 0;rn min = INT_MAX;rnrn for (i = 1; i < n; ++i) rn if (HT[i].weight < min && HT[i].parent == 0) rn m = i;rn min = HT[i].weight;rn rn *c1 = m;rn m = 0; rn min = INT_MAX;rn rn for (i = 1; i < n; ++i) rn if (HT[i].weight < min && HT[i].parent == 0 && i != *c1) rn m = i;rn min = HT[i].weight;rn rn * c2 = m;rnrn if (*c1 > *c2) rn temp = *c1;rn *c1 = * c2;rn *c2 = temp;rn rnrn return OK;rnrnrnstatus huffman_coding(huffman_tree *HT, huffman_code *HC, int * w, int n) rn int i, f, m, c1, c2, c, start;rn huffman_tree p;rn char * cd;rnrn if (n <= 1) rn printf("No need or input error!\n");rn exit(ERROR);rn rn m = 2 * n - 1;rn *HT = (huffman_tree)malloc((m + 1) * sizeof(huffman_tree_node));rn if (!(*HT)) exit(OVERFLOW);rn for (p = *HT + 1, i = 0; i < n; ++i, ++p, ++w) rn p->weight = *w;rn p->parent = p->lchild = p->rchild = 0;rn rnrn for (; i < m + 1; ++i, ++p)rn p->weight = p->parent = p->lchild = p->rchild = 0;rnrn for (i = n + 1; i < m + 1; ++i) rn get_child(*HT, i, &c1, &c2);rn (*HT)[i].lchild = c1;rn (*HT)[i].rchild = c2;rn (*HT)[c1].parent = (*HT)[c2].parent = i;rn (*HT)[i].weight = (*HT)[c1].weight + (*HT)[c2].weight;rn rnrn *HC = (huffman_code)malloc((n + 1) * sizeof(char *));rn if (!(*HC)) exit(OVERFLOW);rn cd = (char *)malloc(n * sizeof(char));rn if (!cd) exit(OVERFLOW);rn cd[n - 1] = '\0';rn for (i = 1; i <= n; ++i) rn start = n - 1;rn for (c = i, f = (*HT)[c].parent; f != 0; rn c = f, f = (*HT)[f].parent) rn if ((*HT)[f].lchild == c)rn cd[--start] = '0';rn else rn cd[--start] = '1';rn rnrn (*HC)[i] = (char *)malloc(sizeof(char) * (n - start));rn if (!(*HC)[i]) exit(OVERFLOW);rn strcpy((*HC)[i], &cd[start]);rn rn free(cd);rnrn return OK;rnrnrnstatus print_code(huffman_code HC, int n) rn int i;rnrn for (i = 1; i <= n; ++i)rn printf("%s\n", HC[i]);rnrn return OK;rnrnrnrnint main(void) rn huffman_tree HT;rn huffman_code HC;rn int weight[MAX], n, temp, i, m;rn rn printf("How many:");rn SCAN_INT(n, temp);rn for (i = 0; i < n; ++i) rn printf("No.%d:", i + 1);rn SCAN_INT(weight[i], temp);rn rnrn huffman_coding(&HT, &HC, weight, n);rn print_code(HC, n);rn rn return 0;rnrn[/code]rnrn该代码在FC4 gcc 4.0下编译通过,运行时出现Segmentation Fault错误提示。GDB之后出现如下错误:rnProgram received signal SIGSEGV, Segmentation fault.rn0x001d1115 in _int_free () from /lib/libc.so.6rnrn反复检查过之后依然找不到头绪,请高手指点一二。rn
关于General Protection fault 的问题
我在一台386的电脑上,用vb3.0编写的一个程序但是运行时经常会报错:应用程序导致general protection fault发生在模块krnl386.exern下面是用Dr.Watson记录的错误信息,请高手看看原因是什么?万分感谢!十分紧急!!!rnrnrnStart Dr. Watson 0.80 - Thu Jun 23 10:06:50 2005rn****************************************************************************rnDr. Watson 0.80 Failure Report - Thu Jun 23 10:07:47 2005rnPRJKYSPC had a 'Exceed Segment Bounds (Read)' fault at KERNEL 1:6517rn$tag$PRJKYSPC$Exceed Segment Bounds (Read)$KERNEL 1:6517$rep movsb$Thu Jun 23 10:07:47 2005rnrnCPU Registers (regs)rnax=0000 bx=2f5c cx=0001 dx=0003 si=03a0 di=6fb2rnip=6517 sp=6ef4 bp=6f8a O- D- I+ S- Z- A- P- C- rncs = 0117 b420:af5f Code Ex/Rrnss = 1fbf 80fed040:829f Data R/W rnds = 1b8f 81147c80:039f Data R/W rnes = 1fbf 80fed040:829f Data R/W rnrnCPU 32 bit Registers (32bit)rneax = 00000000 ebx = 00002f5c ecx = 00000001 edx = 00000003rnesi = 000003a0 edi = 00006fb2 ebp = 00006f8a esp = 80016ee4rnfs = 0000 0:0000 Null Ptr rngs = 0000 0:0000 Null Ptr rneflag = 00000202rnrnSystem Info (info)rnWindows version 3.10rnRetail buildrnWindows Build 3.1rnUsername lwm rnOrganization - BMTD - rnSystem Free Space 255958016rnStack base 9004, top 29334, lowest 26406, size 20330rnSystem resources: USER: 83% free, seg 1827 GDI: 76% free, seg 067frnLargestFree 253849600, MaxPagesAvail 61975, MaxPagesLockable 15786rnTotalLinear 63452, TotalUnlockedPages 15793, FreePages 14561rnTotalPages 16457, FreeLinearSpace 61981, SwapFilePages 63452rnPage Size 4096rn5 tasks executing.rnWinFlags -rn Math coprocessorrn 80486rn Enhanced modern Protect modernrnStack Dump (stack)rnStack Frame 0 is KERNEL 1:6517 ss:bp 1fbf:6f8arn0117:650e aa stosbrn0117:650f c5 76 08 lds si, [bp+08]rn0117:6512 8b 8e ff72 mov cx, [bp+ff72]rn0117:6516 41 inc cxrn(KERNEL:1:6517)rn0117:6517 f3 a4 rep movsbrn0117:6519 1f pop dsrn0117:651a fc cldrn0117:651b 33 c9 xor cx, cxrnrnStack Frame 1 is KERNEL 1:6348 ss:bp 1fbf:701arn0117:6340 8d 46 80 lea ax, [bp+80]rn0117:6343 16 push ssrn0117:6344 50 push axrn0117:6345 e8 0121 call near 6469rn(KERNEL:1:6348)rn0117:6348 8b d8 mov bx, axrn0117:634a 8b f0 mov si, axrn0117:634c e8 00a2 call near 63f1rn0117:634f 56 push sirnrnStack Frame 2 is VBRUN300 25:648b ss:bp 1fbf:7068rnStack Frame 3 is VBRUN300 25:4370 ss:bp 1fbf:70e8rnStack Frame 4 is VBRUN300 25:0000 ss:bp 1fbf:7104rnStack Frame 5 is VBRUN300 25:ffff ss:bp 1fbf:7118rnStack Frame 6 is VBRUN300 25:82f1 ss:bp 1fbf:7122rnStack Frame 7 is VBRUN300 24:0030 ss:bp 1fbf:7150rnStack Frame 8 is VBRUN300 24:0311 ss:bp 1fbf:71a4rnStack Frame 9 is VBRUN300 95:00a4 ss:bp 1fbf:71bernStack Frame 10 is VBRUN300 32:055c ss:bp 1fbf:71e8rnStack Frame 11 is VBRUN300 32:031c ss:bp 1fbf:7214rnStack Frame 12 is USER 1:2801 ss:bp 1fbf:722ernStack Frame 13 is VBRUN300 22:017c ss:bp 1fbf:7262rnStack Frame 14 is VBRUN300 22:0067 ss:bp 1fbf:7270rnStack Frame 15 is VBRUN300 58:2225 ss:bp 1fbf:7282rnStack Frame 16 is VBRUN300 58:1492 ss:bp 1fbf:7294rnSystem Tasks (tasks)rnTask FULLABC, Handle 148f, Flags 0001, Info 11984 03-28-95 1:00rn FileName C:\WINDOWS\SYSTEM\FULLABC.EXErnTask DRWATSON, Handle 13df, Flags 0001, Info 26736 03-28-95 1:00rn FileName C:\WINDOWS\DRWATSON.EXErnTask PROGMAN, Handle 06d7, Flags 0001, Info 114992 03-28-95 1:00rn FileName C:\WINDOWS\PROGMAN.EXErnTask WINFILE, Handle 1387, Flags 0001, Info 145824 03-28-95 1:00rn FileName C:\WINDOWS\WINFILE.EXErnTask PRJKYSPC, Handle 1fe7, Flags 0001, Info 234572 03-13-105 11:19rn FileName C:\XINCHANG\PRJKYSPC.EXE
运行出现Segmentation fault问题
[size=12px]这是一个简单的输出“hello world”的汇编程序rn我的平台rn$uname -arnLinux www 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linuxrn[/size]rn[code=text]rn.code32rn.section .datarn output:rn .asciz "hello world.\n"rn.section .textrn.globl mainrnmain:rn noprn pushl $outputrn call printfrn popl %eaxrnrn pushl $0rn call exitrn[/code]rn编译链接都问题。运行时出现Segmentation fault错误rn调试发现错误在调用printff时,收到了SIGSEGV(无效内存引用)的信号rn请问这是什么原因呢?
(急)Page Fault问题求助
我的vxworks系统启动之后,一运行项目就出现Page Fault的错误,信息如下:rnrn(Tornado里显示的信息)rnException number 14: Task: 0x7f362ec4 (tMyProject)rnrnPage FaultrnProgram Counter: 0x081af6c7rnStatus Register: 0x00010286rnError Code : 0x00000002rn8148b73 iseUsrRoot +b3 : CWDevInit ([eeeeeeee, &vxTaskEntry, 0, 31c0bc, 0])rn8156c2a CWDevInit +81a: drv423 ([eeeeeeee, eeeeeeee, eeeeeeee, eeeeeeee, eeeeeeee])rn816be87 drv423 +167: ser2tyCoDrv (7f361ca4, 7f361c98, 7f361c0a, 7)rn81afce7 ser2tyCoDrv +347: 81b5b40 (82ed6d0, 0, 7, 0)rn81b5b97 ser2tyCo485Set +16e7: 81b4d10 (82ed6d0, a, 10, 8)rn81b4d85 ser2tyCo485Set +8d5: OutReg (90, 0, febff000, 81b3c60)rnrn(串口输出的信息)rnPage FaultrnPage Dir Base : 0x7f3f2000rnEsp0 0x7f361bbc : 0x00000000, 0x00000000, 0x7f361c14, 0x081b5467rnEsp0 0x7f361bcc : 0x00000007, 0x00000000, 0x7f361bf4, 0x081b4d8arnProgram Counter : 0x081af6c7rnCode Selector : 0x00000008rnEflags Register : 0x00010286rnError Code : 0x00000002rnPage Fault Addr : 0xfebff090 rnTask: 0x7f362ec4 "tMyProject"rnrnrn-> lkAddr 0x00010286rnwrs_kernel_text_start 0x00308000 text (vxWorks)rn_sysInit 0x00308000 text (vxWorks)rn_wrs_kernel_text_start 0x00308000 text (vxWorks)rnsysInit 0x00308000 text (vxWorks)rnsysInByte 0x00308080 text (vxWorks)rnsysInWord 0x00308090 text (vxWorks)rnsysInLong 0x003080a0 text (vxWorks)rnsysOutByte 0x003080b0 text (vxWorks)rnsysOutWord 0x003080c0 text (vxWorks)rnsysOutLong 0x003080d0 text (vxWorks)rnsysInWordString 0x003080e0 text (vxWorks)rnsysInLongString 0x00308100 text (vxWorks)rnvalue = 0 = 0x0rn-> rnrn-> lkAddr 0xfebff090rn_dtors 0x0829c2c0 data (cise_f.out)rnrnrnrnrnrn这个怎么去查问题原因啊。
关于swift “Segmentation fault”的问题
最近在用Swift Reflection时,出现了一个“Segmentation fault”。有知道怎么解决这个问题的吗?rn重现问题如下,具体代码在[github](https://github.com/hikelee/SegmentationFault)上rnrn$uname -arn Linux dev 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux rnrn$ swift --versionrn Swift version 3.0 (swift-3.0.1-PREVIEW-1)rn Target: x86_64-unknown-linux-gnurnrn$ git clone https://github.com/hikelee/SegmentationFault.gitrnrn$ cd SegmentationFaultrnrn$ swift buildrn Cloning https://github.com/Zewo/Reflection.gitrn HEAD is now at 2bc1a76 make mappable tests public on reflectionrn Resolved version: 0.14.0rn Compile Swift Module 'Reflection' (23 sources)rn Compile Swift Module 'Main' (1 sources)rn Linking ./.build/debug/Mainrnrn$ .build/debug/Mainrn Person(firstName: "James")rn Person(firstName: "James")rn Person(firstName: "James")rn Person(firstName: "James")rn ------rn Person(firstName: "James")rn Person(firstName: "pb?\0\0\0\0\0a")rn Person(firstName: "\u10\\u10\0a")rn Segmentation faultrn
Unix 下C语言编程的问题 Segmentation fault
调试已经通过,但是在UNIX中运行a.out文件的时候会报出segmentation faultrn[code=c]#includern#includern#includernrnvoid* CaculateLine(void *lines);rnvoid OutMatrix(int* matrix,int row,int column);rnint GetMatrix(char *filename);rnint GetNextValue(FILE *file);rnrnrn//define matrix A and Brnint A_Row, A_Column,B_Row, B_Column;rnint* A,*B;rn//define matrix Crnint C_Row,C_Column;rnint* C;rnrnint main()rnrn //define threadsrn pthread_t * pthreads;rn int i=0;rnrn //read matrixes A and Brn GetMatrix("C:\\matrix.txt");rnrn //out the matrixrn printf("Set 1 Matrix A:\n");rn OutMatrix(A,A_Row,A_Column);rn printf("\nSet 2 Matrix B:\n");rn OutMatrix(B,B_Row,B_Column);rnrn //initialize matrix Crn C_Row=A_Row;rn C_Column=B_Column;rn C=(int*)malloc(sizeof(int)*C_Row*C_Column);rn rn //initialize threads rn rn int* args=(int*)malloc(sizeof(int)*A_Row);//store the arg of the function :CaculateLinern pthreads=(pthread_t*)malloc(sizeof(pthread_t)*A_Row);rn printf("\n");rn for(i=0;i
mysql Segmentation fault的问题,求教
[code=C/C++]int UserByEmail(char str1[],int client)rnrn char buffer[500];rn MYSQL db;/*connector*/rn MYSQL_RES * result;/*result buffer*/rn MYSQL_ROW row;/*one row of the result*/rn int i;rn /*初始化mysql*/rn if(mysql_init(&db)==NULL)rn rn fprintf(stderr,"Fail to initialize the db.\n");rn return;rn rn /*连接数据库*/rn char host[32] = "localhost";rn char user[32] = "mysql";rn char passwd[38] = "passwd";rn char dbc[32] = "mysql";rn char getDate[1024];rn char domain[2000];rn char s[2000];rn memset(getDate,0,1024);rn if (NULL == (mysql_real_connect(&db,host,user,passwd,dbc,0,NULL,0)))rn rn fprintf(stderr,"Connect to mysql Error:%s!",mysql_error(&db));rn return;rn rn char str[2000];rn char str3[]="'";rn memset(str,0,2000);rn char Where_SQL[]="select * from users where email='";rn rn strcat(str,Where_SQL);rn strcat(str,str1);rn strcat(str,str3);rn printf("str=%s\n",str);rn if(mysql_query(&db,str)!= 0) rn // select();rn fprintf(stderr,"Fail to query the db for information.\n");rn return;rn rn /*获得查询结果*/rn result = mysql_store_result(&db);rn if(result)rn rn int num_fields;rn num_fields = mysql_num_rows(result);rn if(num_fields>0)rn rn printf("get the result\n");rn rn elsern rn fprintf(stderr,"Fail to get the result.\n");rn return;rn rn rn elsern rn fprintf(stderr,"Fail to get the result.\n");rn return;rn rnrn struct json_object *dal_data;rn dal_data = json_object_new_object();rnrn while((row=mysql_fetch_row(result)) != NULL)/*fetching each row*/rn rn puts("================================================");rn printf("id: %s\n",row[0]);rn printf("email: %s\n",row[1]);rn printf("password: %s\n",row[2]);rn printf("status: %s\n",row[3]);rn puts("================================================"); rnrn json_object_object_add(dal_data, "id", json_object_new_string(row[0]));rn json_object_object_add(dal_data, "email", json_object_new_string(row[1]));rn json_object_object_add(dal_data, "password", json_object_new_string(row[2]));rn json_object_object_add(dal_data, "status", json_object_new_string(row[3]));rn rn memset(buffer,0,500);rn printf("\necho json_encode(dal_data);\n\n%s\n\n",json_object_to_json_string(dal_data));rn strcat(buffer,json_object_to_json_string(dal_data));rnrn strcat(buffer,"\n");rn ssl_write(client,buffer);//这是个发送数据的函数调用rn rn json_object_put(dal_data);rn mysql_free_result(result);rn mysql_close(&db);/////////////////////////////////////////////////////////////////////////////rn[/code]rn上边是C-mysql一个api,程序在本机跑了好几天都没问题,但是拿到线上测试的时候发现程序跑到mysql_close(&db);(上边已经标出)这一句的时候就断了,错误提示:Segmentation faultrn上线之后程序就改了个mysql的user和passwd,其他的都没改,本机跑没出现过问题rn一上线就断了,把mysql_close(&db);这句注释掉之后程序就没Segmentation fault的错误提示了,但是mysql又不能不关;rn我查过,网上说是 result初始化的问题,可是我初始化了,本机怎么就没问题?rn个人觉得是不是线上环境和本机环境的差别?rn向各位求教~~
小白问题,关于Segment Fault
写ACM里头的一道小白性质的题,跪了,在vs2010上运行正常,提交显示Runtime Error(Segment Fault),搞了一夜,还是不知道怎么改,求大神指导,感激不尽。rn纯属小白,若有白痴处,还请大神详解。rn#include "stdafx.h"rn#include rn#include rnusing namespace std;rnint main ()rnrn int n,m,j,h,k,b=0,i[3];rn for(int q=0;q<3;q++)rn rn i[q]=0;rn rn while(cin>>h)rn rn int **a = new int*[8]; rn for( n=0; n<8; n++) rn a[n] = new int[h]; rnrn for( n=0;n<8;n++)rn rn for(j=0;j>a[n][j];rn rn rn rn for( k=0;k
故障树分析-Fault tree analysis
简要介绍故障树分析的基本方法与相关理论,并对具体案例做出分析,阐述了故障树分析步骤与结果。
Fault tolerant systems design
Fault tolerant systems design
Segmentation fault 郁闷
以下程序是用mysql c api计算t_flow_data表项的记录数:rn编译命令行如下:rngcc -I /usr/local/mysql/include/mysql -c connect_database.crngcc -L /usr/local/mysql/lib/mysql/ -lmysqlclient -lm -o connect_database connernct_database.ornrn执行时,结果正确选择出来了,但是出现Segmentation fault:rnrnConnect SuccrnThe result is 4999999rnSegmentation faultrnrn到底是怎么回事啊?rnrn#include rn#include rn#include "/usr/local/mysql/include/mysql/mysql.h"rn#include "configuration.inc.h"rn/*rn* 函数介绍:该函数负责数据库的连接rn* 输入参数:rn* 输出参数:rn* 返回值 :成功时返回连接标识,否则返回NULLrn* 全局变量:rn* 调用模块:rn* 抛出异常:错误时输出错误信息rn*/rnint Connect_DataBase(MYSQL *db_connect)rnrn mysql_init(db_connect);rnrn if (!mysql_real_connect(db_connect , HOST , DBUSER , DBPASSWD , DBNAME , 0 , rnNULL ,0))rn rn fprintf(stderr , "Failed to Connect DataBase , Error:%s\n" , mysql_error(db_rnconnect));rn return 0;rn rn elsern return 1;rnrnrnint main()rnrn MYSQL *mysql;rn MYSQL_RES *mysql_store;rn MYSQL_ROW row;rn rn if (Connect_DataBase(mysql))/* Connect DataBase*/rn rn printf("Connect Succ\n");rn rn else rn exit(-1);rn rn mysql_query(mysql , "select count(*) from t_flow_data");rn rn mysql_store = mysql_store_result(mysql);rn rn row = mysql_fetch_row(mysql_store);rnrn printf("The result is %s\n" , row[0]);rn rn mysql_free_result(mysql_store);rn mysql_close(mysql);rn rn return 1;rnrn
segment fault错误
写了一个程序,在不绑定sock中的ip的情况下,想得到recvfrom函数用来接收数据的本地IP地址(本机有多个IP地址),有两个问题请教:rn(1)运行时出现segment fault错误,是哪地方出错了呢?rn(2)用getsockname这种方法能得到多ip时,本地接收信息的ip地址吗?rn-----------------rnserver.c,这是服务器端。另有一个client定时向server的指定端口5678发送数据。rn#includern#includern#includernint main()rnrn int sock, pport;;rn char buff[100];rn socklen_t i;rn char *p;rn p=(char *)malloc(100*sizeof(char));rn struct sockaddr_in address,ad,source;rn address.sin_family=AF_INET;rn address.sin_port=htons(5678);rn sock=socket(AF_INET,SOCK_DGRAM,0);rn bind(sock,(struct sockaddr *)&address,sizeof(address));rn source.sin_family=AF_INET;rn ad.sin_family=AF_INET;rn i = sizeof(struct sockaddr_in);rn recvfrom(sock,buff,500,0,(struct sockaddr *)&source,&i);rn printf("Data recieved is:%s\n",buff);rn i = sizeof(struct sockaddr_in);rn if(getsockname(sock,(struct sockaddr *)&ad,&i))rn rn puts("Error!");rn rn printf("i is:%d\n",i);rn p=inet_ntoa(ad.sin_addr.s_addr);rn printf("Ip is:%s\n",p);rn fclose(sock);rnrn
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件