请问在vs2017平台运行以下程序为什么会出错

小白求问。
第一个划红线的地方改成const char 就好,
但是第二处就不知道怎么办了。
求各位高手指点
图片说明

0

5个回答

sorry 上面弄错了

#include
int main()
{
const char* name[] = { "xingjia","xingjia2", "xingjia3", "xingjia4", "xingjia5" };
const char**p;
int i;
for (i = 0; i < 5; i++)
{
p = (name + i);
printf("%s\n", *p);
}
return 0;
}

1

图片说明
也新手

const char **p;
可以运行 原理在看看

0

const char *name; 去掉const

0
qq_23126581
玄元复始道生初,守一无穷尽万物 回复qq_43185537: 所有代码发出来,我帮你调试
12 个月之前 回复
qq_43185537
sakura_li 去掉const第一部分就报错了
12 个月之前 回复

p=(const char *)(name+i)

0

1、python ioerror的出现:打开一个不存在的文件,示例中有意输入了一个不存在的文件名,并试图打开它。程序找不到这个文件名所以引发了IOError
?
1
2
3
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: 'a.txt'
2、文件写入时遇到python error错误原因?有同学遇到了IOError Errno 0 错误的情况,在用a+方式打开文件,之后读取该文件内容。修改读取的内容后重新写入文件,在写入时程序也遇到了IOError错误。这时要注意在读取文件之后记得要把文件关闭,当你需要写入文件时,要再将文件以w+方式打开写入。加深学习Python open()函数文件打开、读、写基础操作,可以减少类似情况发生。
3、当你不能满足被访问文件所设置的权限时,也会引发IO Error错误,类似这样IOError: [Errno 13] Permission denied: 'c:/a.txt' python permission denied 从字面意思来理解就可以知道原因了,是因为我们执行的命令(运行python文件等),没有权限,给一个超级管理员权限就可以了。

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
请问为什么以下会出错?
我用以下语句在下判断是否满足条件,但总是提示:rnrn编译器错误信息: CS1040: 预处理器指令必须作为一行的第一个非空白字符出现rnrn<% if ( <%# DataBinder.Eval(Container.DataItem, "n1") %> == "2" ) %>rn 3rnrn <% else %>rnrn 3 rnrn<% %>rnrn请问为什么?
请问以下代码为什么会出错?
#include rn#include rn#include rnrnint main() rn // The full format for the Connection constructor isrn // Connection(cchar *db, cchar *host="",rn // cchar *user="", cchar *passwd="")rn // You may need to specify some of them if the database is not onrn // the local machine or you database username is not the same as yourrn // login name, etc..rn try rn Connection con("mysql_cpp_data");rn Query query = con.query();rn // This creates a query object that is bound to con.rnrn query << "select * from stock";rn // You can write to the query object like you would any other ostremrnrn Result res = query.store();rn // Query::store() executes the query and returns the resultsrnrn cout << "Query: " << query.preview() << endl;rn // Query::preview() simply returns a string with the current queryrn // string in it.rnrn cout << "Records Found: " << res.size() << endl << endl;rnrn Row row;rn cout.setf(ios::left);rn cout << setw(17) << "Item"rn << setw(4) << "Num"rn << setw(7) << "Weight"rn << setw(7) << "Price"rn << "Date" << endlrn << endl;rnrn Result::iterator i;rn // The Result class has a read-only Random Access Iteratorrn for (i = res.begin(); i != res.end(); i++) rn row = *i;rn cout << setw(17) << row[0].c_str()rn << setw(4) << row[1].c_str()rn << setw(7) << row["weight"].c_str()rn // you can use either the index number or column name whenrn // retrieving the colume data as demonstrated above.rn << setw(7) << row[3].c_str()rn << row[4] << endl;rn rn catch (BadQuery &er) // handle any connection orrn // query errors that may come uprn#ifdef USE_STANDARD_EXCEPTIONrn cerr << "Error: " << er.what() << endl;rn#elsern cerr << "Error: " << er.error << endl;rn#endifrn return -1;rn catch (BadConversion &er) // handle bad conversionsrn#ifdef USE_STANDARD_EXCEPTIONrn cerr << "Error: " << er.what() << "\"." << endlrn << "retrieved data size: " << er.retrievedrn << " actual data size: " << er.actual_size << endl;rn#elsern cerr << "Error: Tried to convert \"" << er.data << "\" to a \""rn << er.type_name << "\"." << endl;rn#endifrn return -1;rn#ifdef USE_STANDARD_EXCEPTIONrn catch (exception &er) rn cerr << "Error: " << er.what() << endl;rn return -1;rn#endifrn rn return 0;rnrnrn编译时的命令是:g++ -g -O2 -L/usr/lib/mysql -o /home/jc/mysql++-1.7.9/examples/simple1.o /home/jc/mysql++-1.7.9/sqlplusint/.libs/libsqlplus.so -lz -lmysqlclient -lz -lmysqlclient -Wl,--rpath -Wl,/www/mysql/lib -Wl,--rpath -Wl,/usr/librn出错信息是:usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':rn/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'rnrn
以下代码为什么会出错?
为什么无法运行呢?提示是:rn[C++ Error] Unit1.cpp(25): E2268 Call to undefined function 'min'rnrn//---------------------------------------------------------------------------rnrn#include rnrn#pragma hdrstoprnrn#include "Unit1.h"rn#include rn//---------------------------------------------------------------------------rn#pragma package(smart_init)rn#pragma resource "*.dfm"rnTForm1 *Form1;rn//---------------------------------------------------------------------------rn__fastcall TForm1::TForm1(TComponent* Owner)rn : TForm(Owner)rnrnrn//---------------------------------------------------------------------------rnrnvoid __fastcall TForm1::Button1Click(TObject *Sender)rnrn int a=5;rn int b=6;rn int c;rn c=min(a,b);rn ShowMessage(IntToStr(c));rnrn//---------------------------------------------------------------------------rn
以下代码为什么会出错
rn Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadrnrnrn Dim dst As New DataSet()rn Dim con As New SqlClient.SqlConnection()rn Dim dad As New SqlClient.SqlDataAdapter()rn Dim bb As DataViewrn Dim arr(2) As Objectrn Dim introwindex As Integerrnrnrnrnrn dst = New DataSet()rnrnrn con = New SqlClient.SqlConnection("server=localhost;uid=sa;database=pubs")rn dad = New SqlClient.SqlDataAdapter("select * from authors", con)rn dad.Fill(dst, "authors")rn bb = dst.Tables("authors").DefaultView()rn bb.Sort = "au_lname,au_fname"rnrn arr(0) = "dull"rnrn arr(1) = "ann"rnrn introwindex = bb.Find(arr)rn If introwindex <> -1 Thenrn Response.Write(bb(introwindex).Row("phone"))rn Elsern Response.Write("no...")rn Endrn End Sub
第二次运行到该程序会出错,为什么?
第二次运行到:rnrnvoid __fastcall TFInnerVerh::btn_okClick(TObject *Sender)rnrn this->get_InnerVerh_ini(); // 读取打印机设置信息rn this->QR_InnerVerh->Print(); // 用报表控件实现打印rn}rnrn会出错,具体到get_InnerVerh_ini();这一行,该函数定义如下:rnrn//从ini文件中打印设置rnint __fastcall TFInnerVerh::get_InnerVerh_ini()rnrn TIniFile *r_ini = new TIniFile("../config/InnerVerhPrinter.ini");rn try rn // QR_InnerVerh->PrinterSettings->Copies = 1; //打印份数 1rn QR_InnerVerh->PrinterSettings->PrinterIndex = r_ini->ReadString("PRINTERSET", "Printer", "").ToInt();rn __finally rn delete r_ini;rn rn return 1;rnrnrn运行至try中的内容时,出错。rnrn其中,ini配置文件的内容是:rnrn[PRINTERSET]rnPrinter=1rnrn只有两行。rnrn*****************************rnrn按理说是不可能出错的,很不好理解,更无从改错,请问是什么原因?
为什么我的DAO程序会运行出错?
我用vc开发采用DAO访问ACCESS数据库的程序在我自己的机器(装有VC)上运行正常,但是把程序copy到别的机器上(没装VC)就会出错,提示“无法对DAO/jet db引擎进行初始化”,这是怎么回事?我应该如何处理,才能正常运行?谢谢!rn
请问为什么会出错?
class java_inrn static int i;rn public static void main(String args[])rn i=System.in.read(); <<---这句报出错rn System.out.println("I="+i);rn rnrn
请问为什么会出错?
请问alert( $("#trimTest").rtrim(" test ")); 为什么会出错?rn1、alert(jQuery.rtrim(" test "));中的jQuery是不是一个对象rn2、$("#trimTest")也是返回一个jQuery对象,alert( $("#trimTest").rtrim(" test ")); 应该不会出错啊!rnrn rnrnrnrnrnrn 插件2,ltrim,rtrimrn rnrnrn rn rnrnrnrnrnrnrn
请问为什么会出错
CREATE OR REPLACE PROCEDURE BASE.T_TEST (rnv_test in varchar2rn)rnASrntype ar is varray(2) of varchar2(2);rnv_sign_num ar;rn i number(2);rn BEGINrn i:=1;rn v_sign_num(1) :='s';rn v_sign_num(2) :='s';rn dbms_output.put_line(v_sign_num(1));rnrn END;rn/rn上面是一个存储过程,编译已经通过,rn但在运行时却报出已下错误信息,哪位大侠能告诉我怎么解决这个问题,谢谢!rn错误信息:rnERROR 位于第 1 行:rnORA-06531: Reference to uninitialized collectionrnORA-06512: at "BASE.T_TEST", line 10rnORA-06512: at line 1
请问为什么以下MYSQL为什么会执行出错
![图片说明](https://img-ask.csdn.net/upload/201801/30/1517280474_232098.png)n请问这段MYSQL有错吗n![图片说明](https://img-ask.csdn.net/upload/201801/30/1517280494_634412.png)n老是这样n![图片说明](https://img-ask.csdn.net/upload/201801/30/1517280517_245051.png)n但是执行的时候没有错
为什么运行到subclasswindow会出错?
CPasswordEdit m_Password;//CPasswordEdit 是一个继承于CEdit的类rnrnm_Password.SubclassWindow(GetDlgItem(IDC_EDIT1)->m_hWnd);//在对话框的OnInitDialog()函数忠
请问这个程序为什么会出错呢?
#includern#includern#includernusing namespace std;rnclass person rnpublic:rn person(char* pid="noid", char* pname="noname");rn virtual ~person();rn virtual void show();rnprotected:rn char* id,* name;rn;rnclass teacher:public person rnpublic:rn teacher(char* pid="notid",char* pname="notname",char* pdepart="nodepart",char* ptitle="notit");rn ~teacher()rn delete [] title;rn delete [] depart;rn rn void show();rnprivate:rn char* depart,* title;rn;rnteacher::teacher(char* pid,char* pname,char* pdepart,char* ptitle):rnperson(pid,pname) rn depart = new char[strlen(pdepart+1)];rn title = new char[strlen(ptitle)+1];rn if(!pdepart || !ptitle) rn cerr<<"Allocating Error"<
请看以下代码为什么close会出错?
beginrn Application.Initialize;rn Application.Title := '契税管理系统';rn Application.CreateForm(TfrmMain, frmMain);rn Application.CreateForm(TDM, DM);rn if isValid=true thenrn beginrn Application.Run;rn endrn elsern close;rnrnend.
以下数据库分页程序,为什么会出错
查询数据库中的记录,但是数量太大,所以在数据库内部分页,结果出错。rnpublic void getPageData(int startNo,int maxCount)rn String sql = "select xxso_nbr from pub.xxso_mstr";// 查询对方主表数据rn Statement stmt =con.createStatement ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);rn //最大查询到第几条记录rn stmt.setMaxRows(startNo+maxCount-1);rn ResultSet rs = stmt.executeQuery(sql);rn //将游标移动到第一条记录rn rs.first();rn //游标移动到要输出的第一条记录rn rs.relative(startNo-2);rn while(rs.next())rn System.out.println(rs.getInt(1));// MYECLIPSE报的出错行,报java.sql.SQLException: 然后是堆栈信息。rnMYECLIPSE这样报错,我也不知道到底哪错了?
请问 window.SetFocus(); 为什么会出错????
请问 window.SetFocus(); 为什么会出错????rnrnrn我想使整个IE窗口得到 焦点rnrnrnrn
请问以下SQL语句为何会出错?
我使用DELPHI5,用ado连接ACCESS2000数据库rn在程序中有以下语句:rnsql.clear;rnsql.add('delete * from 表1 where 表1.no like :nostr');rnparameters.paramvalues['nostr']:=edit1.text+'%';rnexecsql;rnrn在执行的时候,出错,说在某个dll文件出现错误(和ado有关的dll)rnrn在同一个程序中,我执行另一个语句则正常:rndelete * from 表1 where 表1.no>:nostrrnrnrn请问是怎么回事?rnrnrn
这个程序为什么会出错~
public class test rnrn public static void main(String[] args)rn rn int i = 015;rn int j = 032; rn int l = 078;rn System.out.println(i);rn System.out.println(j);rn System.out.println(l);rn rnrn出错提示:test.java:7: integer number too large: 078
这个程序为什么会出错
using System;rnrnnamespace ConsoleApplication3rnrn class Class1rn rn [STAThread]rn static void Main(string[] args)rn rn MyClass c1 = new MyClass();rn MyClass c2 = new MySubClass();rn MySubClass c3 = new MySubClass(); rn Console.WriteLine(c1.Hello());rn Console.WriteLine(c2.Hello());rn Console.WriteLine(c3.Hello());rn Console.ReadLine();rn rn rnrn abstract class MyClassrn rn public virtual string Hello()rn rn return "Hello, MyClass";rn rn rnrn class MySubClass : MyClassrn rn public override string Hello()rn rn return "Hello, MySubClass";rn rn rnrnrnrnrnrn我把MyClass类标注为abstract 后为什么会出错,如果要标注为抽象的话该怎么改
为什么下面的程序会出错?
//1.cpprn#include "1.h"rnvoid main()rnrndo();rnrnrnrn//1.hrnvoid do()rn rnrn
这段程序为什么会出错?
#includernusing namespace std;rnclass parentrnrnpublic:rn virtual void output();rn;rnvoid parent::output()rnrn printf("parent!");rnrnrnclass son:public parentrnrnpublic:rn virtual void output();rn;rnvoid son::output()rnrn printf("son!");rnrnrnvoid main()rnrn son s;rn ::memset(&s,0,sizeof(s));rn parent& p = s;rn p.output();rnrnrnp是s的引用,当最后是s.output()是程序正常,rn可改成p.output()后,编译没有问题,可运行rn就会出错。为什么?
为什么我的程序会出错???
这是我用C#写的求解的N阶线性方程组的程序,可是却出现3个零,百思不得其解rn我输入的是11,-3,-2,-23,11,1,1,-2,2,这是方程组的系数.3,0,1,这是常数.rnrnrnusing System;rnrnnamespace Guassrnrn public class Guassrn rn private int n;rn private int[,] A;rn private int[] B;rn private int[] X;rn rn rn public Guass(int b)rn rn n=b;rn A=new int[b,b];rn B=new int[b];rn X=new int[b];rn rn rn//输出rn public void output() rn rn System.Collections.IEnumerator myEnumerator =X.GetEnumerator();rn int i = 0;rn int cols = X.GetLength( X.Rank -1);rn while ( myEnumerator.MoveNext() ) rn rn if ( i < cols ) rn rn i++;rn rn else rn rn Console.WriteLine();rn i = 1;rn rn Console.Write( "\t0", myEnumerator.Current );rn rn Console.WriteLine();rn rnrn public void inputA()rn rn Console.WriteLine("Please input numbers A now");rn for(int i=0;id)rn rn d=Math.Abs(A[i,j]);rn JS[k]=j;rn L=i;rn rn rn rn //奇异 rn if (d+1.0==1.0) rn flag=false;return flag;rn rn// if (L!=k)rn// rn// for(int z=k;zrn /// 应用程序的主入口点。rn /// rn [STAThread]rn static void Main(string[] args)rn rn //tryrn //rn Guass demo=new Guass(3);rn demo.inputA();rn demo.inputB();rn demo.figure();rn demo.output();rn //rn //catch(Exception e)rn //rn // Console.WriteLine(e.Message);rn //rn Console.ReadLine();rn rn rn rnrn
PHP的PDO以下这个程序为什么会出错?
[code=php]rnprepare($query);rnrn $name = '张某某';rn $address = '海珠区';rn $phone = '15814535527';rn $stmt->bindParam(1, $name);rn $stmt->bindParam(2, $address);rn $stmt->bindParam(3, $phone);rnrn $stmt->execute();rn if ($insertID = $dbh->lastInsertId()) rn echo $insertID.' ';rn else rn echo '插入出错!';rn exit();rn rn catch(PDOException $d) rn echo '数据库连接失败:'.$e->getMessage();rn exit();rnrnrn[/code]rnrnmysql:rn[img=https://img-bbs.csdn.net/upload/201309/17/1379427910_696306.jpg][/img]rnrn结果是:插入出错!rnrn不知道为什么会插入不成功??而且在数据库里真的插入不成功
请问这个程序哪里出错?为什么会出错?谢谢!
#define NULL 0rn#define TYPE struct sturn#define LEN sizeof (struct stu)rnstruct sturnrnint num;rnint age;rnstruct stu *next;rn;rnTYPE creat(int n)rnrnstruct stu *head,*pf,*pb;rnint i;rnfor(i=0;inum,&pb->age);rnif(i==0)rnpf=head=pb;rnelse pf->next=pb;rnpb->next=NULL;rnpf=pb;rnrngetch();rnreturn(head);rnrnmain()rnrn creat(3);rn rn请问这个程序哪里出错?为什么会出错?谢谢!
这段程序为什么运行出错?
这是从书中抄录的程序,编译通过,但运行时出现下列错误:rnjava.lang.NoSuchMethodError: mainrnException in thread "main"rnrn我百思不得其解,程序代码如下,请高手指点:rnrn// 直接扩展Thread类,创建和运行线程的测试rnclass TestedThread extends Threadrnrn private int countDown = 4;rn private int threadNumber;rn private static int threadCount = 0;rnrn public TestedThread()rn rn threadNumber = ++threadCount;rn System.out.println("在构造方法体内:(" + threadNumber + ") 创建线程" + getName());rn rnrn public void run()rn rn while (true)rn rn System.out.println("在run()方法体内:(" + threadNumber + ") " + getName());rn if (--countDown == 0)rn return;rn rn rnrnrnpublic class ThreadTestrnrn public static void main(String args[])rn rn for(int i = 0; i < 4; i++)rn rn new TestedThread().start();rn rn System.out.println("\n *** 所有的线程都已启动! *** \n");rn rnrnrn
请问.NET会运行于什么平台?
请问.NET会运行于什么平台?rn而C#是可夸平台夸语言的,rn那它除了运行于.NET上,rn还可以运行于什么地方?rn或是只能运行于MS的产品,rn如x-box之类?
以下这段程序会报错为什么?
package sks;rnimport java.io.PrintStream;rnimport java.sql.*;rnimport java.util.*;rnpublic class ConnBeanrnrnrn public ConnBean()rn rn sDBDrive = "com.microsoft.jdbc.sqlserver.SQLServerDriver";rn sDBSource = "jdbc:microsoft:sqlserver://DOLPHIN(Windows NT);DatabaseName=sks;User=sa;Password=''";rn conn = null;rn stmt = null;rn rs = null;rn tryrn rn Class.forName(sDBDrive);rn rn catch(ClassNotFoundException classnotfoundexception)rn rn System.err.println("ConnBean():".concat(String.valueOf(String.valueOf(classnotfoundexception.getMessage()))));rn rn tryrn rn conn = DriverManager.getConnection(sDBSource);rn stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);rn rn catch(SQLException sqlexception)rn rn System.err.println("ConnBean():".concat(String.valueOf(String.valueOf(sqlexception.getMessage()))));rn rn rnrn public ResultSet executeQuery(String s)rn rn rs = null;rn tryrn rn rs = stmt.executeQuery(s);rn rn catch(SQLException sqlexception)rn rn System.err.println("executeQuery:".concat(String.valueOf(String.valueOf(sqlexception.getMessage()))));rn rn return rs;rn rnrn public void executeUpdate(String s)rn rn tryrn rn stmt.executeUpdate(s);rn rn catch(SQLException sqlexception)rn rn System.err.println("executeUpdate:".concat(String.valueOf(String.valueOf(sqlexception.getMessage()))));rn rn rnrn String sDBDrive;rn String sDBSource;rn Connection conn;rn Statement stmt;rn ResultSet rs;rn public static void main(String[] args)throws Exception rn tryrn rn String sql;rn ResultSet rs;rn sql="select * from CustomRecord where KHBH=2";rn ConnBean conn=new ConnBean();rn rs=conn.executeQuery(sql);rn while(rs.next())rn rn System.out.print(rs.getString("KHBH"));rn rn catch(Exception e)rn System.out.print(e.getMessage());rn rn rnrnrn报出来是ConnBean():com.microsoft.jdbc.sqlserver.SQLServerDriverrnConnBean():No suitable driverrnnullPress any key to continue...rnrn为什么?怎样可以解决?
十万火急,为什么以下的程序会引发非法操作?
每当连续运行几分钟后,就会引起异常“out of memory while expanding memory stream!"rn在程序中,我每接收完一次stream后都有将它清空的,应该不会out of memory的哇。rn请各位帮忙看看是不是我的代码有什么问题?rnrn其中TForm1::ScreenCap用于截取屏幕的,而TMyThread::Excute是用来传送数据的。rn以下是unit1.hrn//---------------------------------------------------------------------------rn#ifndef Unit1Hrn#define Unit1Hrn//---------------------------------------------------------------------------rn#include rn#include rn#include rn#include rn#include rn#include rn#include rn//---------------------------------------------------------------------------rnclass TMyThread : public TThread //User define by cjqrnrnpublic:rn __fastcall TMyThread(void);rnprivate:rn void __fastcall Execute(void);rn;rn//---------------------------------------------------------------------------rnclass TForm1 : public TFormrnrn__published: // IDE-managed Componentsrn TLabel *Label0;rn TBevel *Bevel0;rn TStaticText *StaticText0;rn TButton *Button1;rn TNMUDP *NMUDP1;rn TImage *Image1;rn TComboBox *ComboBox1;rn TTimer *Timer1;rn TSpeedButton *SpeedButton1;rn TLabel *Label1;rn TLabel *Label3;rn TSpeedButton *SpeedButton2;rn TLabel *Label2;rn void __fastcall Button1Click(TObject *Sender);rn void __fastcall FormCreate(TObject *Sender);rn void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);rn void __fastcall Timer1Timer(TObject *Sender);rn void __fastcall SpeedButton1Click(TObject *Sender);rn void __fastcall NMUDP1DataReceived(TComponent *Sender,rn int NumberBytes, AnsiString FromIP, int Port);rnprivate: // User declarationsrnpublic: // User declarationsrn __fastcall TForm1(TComponent* Owner);rn void __fastcall ScreenCap(int LeftPos,int TopPos,int RightPos,int BottomPos);rn TMemoryStream *BmpStream;rn TMemoryStream *RsltStream;rn TMemoryStream *TmpStream;rn TMyThread *MyThread;rn bool Send;rn;rn//---------------------------------------------------------------------------rnextern PACKAGE TForm1 *Form1;rn//---------------------------------------------------------------------------rn#endifrnrn以下是unit1.cpprn//---------------------------------------------------------------------------rn#include rn#pragma hdrstoprnrn#include "Unit1.h"rn//---------------------------------------------------------------------------rn#pragma package(smart_init)rn#pragma resource "*.dfm"rnTForm1 *Form1;rn//---------------------------------------------------------------------------rn__fastcall TForm1::TForm1(TComponent* Owner)rn : TForm(Owner)rnrn Send = false;rnrn//---------------------------------------------------------------------------rnvoid __fastcall TForm1::Button1Click(TObject *Sender)rnrn Send = !false;rnrn//---------------------------------------------------------------------------rnvoid __fastcall TForm1::ScreenCap(int LeftPos,int TopPos,int RightPos,int BottomPos)rnrnint RectWidth,RectHeight;rnHDC SourceDC,DestDC,Bhandle;rnGraphics::TBitmap *Bitmap = new Graphics::TBitmap();rn RectWidth = RightPos-LeftPos;rn RectHeight = BottomPos-TopPos;rn// SourceDC = CreateDC("DISPLAY","","",NULL);rn SourceDC = CreateDC("DISPLAY",NULL,NULL,NULL);rn DestDC = CreateCompatibleDC(SourceDC);rn Bhandle = CreateCompatibleBitmap(SourceDC,RectWidth,RectHeight);rn SelectObject(DestDC,Bhandle);rn BitBlt(DestDC,0,0,RectWidth,RectHeight,SourceDC,LeftPos,TopPos,SRCCOPY);rn Bitmap->Handle = Bhandle;rn BmpStream->Clear();//清空流rn Bitmap->SaveToStream(BmpStream);rnrn// Canvas->Draw(0,0,Bitmap);rn// Bitmap->SaveToFile("Temp.bmp");rn delete Bitmap;rn DeleteDC(DestDC);rn ReleaseDC(Bhandle,SourceDC);rnrn//---------------------------------------------------------------------------rnrnvoid __fastcall TForm1::FormCreate(TObject *Sender)rnrn BmpStream = new TMemoryStream();rn// BmpStream->Size = 1024*768*3;rn RsltStream = new TMemoryStream();rn RsltStream->Size = 1024*768*3;rn TmpStream = new TMemoryStream();rn MyThread = new TMyThread; //Start the background threadrnrn//---------------------------------------------------------------------------rnvoid __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)rnrn if(SpeedButton1->Down)rn rn CanClose = false;rn return;rn rn Timer1->Enabled = false;rn MyThread->Terminate(); //Stop the background threadrn delete BmpStream;rn delete RsltStream;rn delete TmpStream;rnrn//---------------------------------------------------------------------------rnvoid __fastcall TForm1::Timer1Timer(TObject *Sender)rnrn Button1Click(Sender);rnrn//---------------------------------------------------------------------------rnrnvoid __fastcall TForm1::SpeedButton1Click(TObject *Sender)rnrn Button1->Enabled = !SpeedButton1->Down;rn ComboBox1->Enabled = !SpeedButton1->Down;rn Timer1->Enabled = SpeedButton1->Down;rnrn//---------------------------------------------------------------------------rn__fastcall TMyThread::TMyThread(void) : TThread(TRUE)rnrn Priority = tpIdle;rn Resume(); //Resume the threadrnrn//----------------------------------------------------------------------------rnvoid __fastcall TMyThread::Execute(void)rnrn while(1)rn rn if(Form1->Send)rn rn if(Form1->SpeedButton2->Down)rn Form1->ScreenCap(0,0,350,200);rn elsern Form1->ScreenCap(0,0,Screen->Width,Screen->Height);rnrn const int ThreshHold = 2048;rn Form1->BmpStream->Position = 0;rnrn char *Buffer = new char[ThreshHold];rn int BuffSize = Form1->BmpStream->Size;rn int Buffers = BuffSize/ThreshHold;rn Form1->NMUDP1->RemoteHost = Form1->ComboBox1->Text;rn for(int i=0; i <= Buffers; i++)rn Sleep(1);rn if(BuffSize > 2048)rn rn Form1->BmpStream->Read(Buffer, ThreshHold);rn Form1->NMUDP1->SendBuffer(Buffer, ThreshHold, ThreshHold);rn elsern rn if(BuffSize<=0) break;rn Form1->BmpStream->Read(Buffer, BuffSize);rn Form1->NMUDP1->SendBuffer(Buffer, BuffSize, BuffSize);rn rn BuffSize -= ThreshHold;rn rn Form1->NMUDP1->SendBuffer("E", 1, 1);rn delete Buffer;rn rn Form1->Send = false;rn rnrn//----------------------------------------------------------------------------rnrnrnvoid __fastcall TForm1::NMUDP1DataReceived(TComponent *Sender,rn int NumberBytes, AnsiString FromIP, int Port)rnrn TmpStream->Clear();rn if(NumberBytes != 1) //数据已读完rn rn NMUDP1->ReadStream(TmpStream);rn RsltStream->CopyFrom(TmpStream,NumberBytes);rn rn if(NumberBytes == 1) //数据已读完rn rn RsltStream->Position = 0;rn tryrn Image1->Picture->Bitmap->LoadFromStream(RsltStream);rn rn catch ( ... )rn rn rn RsltStream->Clear();rn rnrn//------------------------------------------------------------------------rn rnrn rn
为什么以下SQL出错?
目的:将Ledgers表中的amount字段汇总后来更新OB表中的This_Period_occurred字段。rnrnUPDATE OB SET OB.This_Period_Occurred = (SELECT SUM(Amount) FROM Ledgers WHERE Ledgers.Profile_id = OB.Profile_id);rnrn非常感谢!rn
使用UpdateData(true)为什么会运行出错?
在一个对话框的控件中定义了一个消息响应函数,rnrn里面用UpdateData(true)来刷新控件对应的变量,rnrn但运行总是出错,该内存不能为“read”云云。。。rnrn通过调试可以确定就是运行到这一句时出错的。
为什么运行记录集总数会出错
这是一视图OnInitialUpdate()的部分代码rnm_JczlSet.m_pDatabase=&theApp.db;rn m_JczlSet.Open();rn m_YhzlSet.m_pDatabase=&theApp.db;rn m_YhzlSet.Open();rn //nCount=m_YhzlSet.GetRecordCount();rn //nLrCount=m_YqfbSet->GetRecordCount();rn一旦打开两个//,系统就回出错,显示执行非法操作,为什么?rn如果要得到记录集的记录数目,该怎么做?如果想得到一字段最大(小)值又该怎么做
为什么运行ejb客户端会出错?
什么原因?rn谢谢大家!rnrn一个简单的HelloWorld入门程序,编译和部署都正常,运行:rnjava -classpath %j2ee_home%\lib\j2ee.jar;.;HelloWorldClient.jar Clientrn报错:rnjava.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:rn org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: Norn at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemExceptiornn(ShutdownUtilDelegate.java:87)rn at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)rn at _RemoteHome_Stub.create(Unknown Source)rn at Client.main(Client.java:14)rnCaused by: org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed:rnNorn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rnrn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructrnorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCrnonstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:274)rn at java.lang.Class.newInstance0(Class.java:306)rn at java.lang.Class.newInstance(Class.java:259)rn at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExcrneption(ReplyMessage_1_2.java:93)rn at com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(rnClientResponseImpl.java:108)rn at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOAClirnentSC.java:136)rn at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)rn ... 2 more
运行addnew语句为什么会出错?
myset的基类是CDaoRecordset ,m_set是myset的一个实例. rn运行如下语句:rn m_set.Open();rn m_set.AddNew();rn提示出错:rncan not update.database or object is read_onlyrnrn为什么会这样?CDaoRecordset的有没有自己的连接数据库的成员函数?
请问各位以下代码为什么出错?
int pointx,pointy;rnTPrinter printer;rnbeginrnrnPointX:=GetDeviceCaps(printer->Handle,LOGPIXELSX);rnpointy:=GetDeviceCaps(printer->Handle,LOGPIXELSX);rnrnend;
运行后出错,如下.请问为什么会这样?
Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.HttpUtility.UrlEncode(string)' has some invalid argumentsrnrnSource Error: rnLine 61: rnLine 62: rnLine 63: rnLine 64: rnLine 65: rnrnSource File: F:\NetRun\html\network_course\student\index.aspx Line: 63 rnrn
为什么这个程序在win2003下可以运行但在win2000会出错
一个文章系统的文章显示部分(下载地址:http://www.rfidsky.net/rfid.zip)在windows server 2003下运行正常,但在windows 2000 下提示list.cs的第33行错误,把该行禁用后就正常了,那是一个update语句的执行部分,用于更新页面访问量统计,禁用后将不能统计页面访问量,请问是什么问题?rn下面是同一个程序在不同的服务器上运行的结果rnhttp://www.rfidsky.net/list.aspx?id=44rnhttp://www.bdlgf.com/samuel/list.aspx?id=44rn详细的错误信息如下:rn“/”应用程序中的服务器错误。rn--------------------------------------------------------------------------------rnrn操作必须使用一个可更新的查询。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.Data.OleDb.OleDbException: 操作必须使用一个可更新的查询。rnrn源错误: rnrnrn行 31: reader.Close();rn行 32: myCommand2.CommandText = "UPDATE list SET click = "+i.ToString()+" WHERE id= "+newsid;rn行 33: myCommand2.ExecuteNonQuery();rn行 34: myCommand2.Connection.Close();rn行 35: myConnection.Close();rn rnrn源文件: D:\EfangVHost32\HomeDir\rfidsky\web\list.cs 行: 33 rnrn堆栈跟踪: rnrnrn[OleDbException (0x80004005): 操作必须使用一个可更新的查询。]rn System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41rn System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174rn System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92rn System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65rn System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112rn System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66rn www.MyCodeBehind.Page_Load(Object sender, EventArgs e) in D:\EfangVHost32\HomeDir\rfidsky\web\list.cs:33rn System.Web.UI.Control.OnLoad(EventArgs e) +67rn System.Web.UI.Control.LoadRecursive() +35rn System.Web.UI.Page.ProcessRequestMain() +750rnrn rnrnrn--------------------------------------------------------------------------------rn版本信息: Microsoft .NET Framework 版本:1.1.4322.2032; ASP.NET 版本:1.1.4322.2032
大家看看这个程序为什么会运行出错?(书上的例题)
//------KeyinEvent.java-------rnpackage character;rnimport javax.swing.*;rnimport java.awt.*;rnimport java.awt.event.*;rnimport character.MyWindowListener;rnpublic class KeyinEvent extends JFrame implements KeyListener rn private JTextArea textArea;rn public KeyinEvent()rn rn super("KeyinEvent.java:按建事件测试");rn Container c=getContentPane();rn c.setLayout(new FlowLayout());rn textArea=new JTextArea(4,20);rn textArea.setText("请按任意键");rn c.add(textArea);rn addKeyListener(this);rn setSize(350,120);rn show();rn rn public void keyPressed(keyEvent e)rn rn String line1="按键:"+e.getKeyChar();rn String line2="按键是否为Action键:"+e.isActionKey();rn String mKey=e.getKeyModifiersText(e.getModifiers());rn String line3="是否按下Modifier键:"+(mKey.equals("")?"否":"是,其键为"+mKey);rn textArea.setText(line1+"\n"+line2+"\n"+line3+"\n");rn rn public void keyReleased(KeyEvent e) rn public void keyTyped(KeyEvent e) rn public static void main(String[] args) rn LeuomEvent app=new KeyinEvent();rn app.addWindowListener(new MyWindowListener());rn rnrn//----MyWindowListener----rnpackage character;rnimport java.awt.*;rnimport java.awt.event.*;rnclass MyWindowListener extends WindowAdapterrn rn public void windowClosing(WindowEvent e)rn rn System.exit(1);rn rn rnrn错误信息为rn"KeyinEvent.java": Error #: 300 : class keyEvent not found in class character.KeyinEvent at line 21, column 26rn"KeyinEvent.java": Error #: 454 : class character.KeyinEvent should be declared abstract; it does not define method keyPressed(java.awt.event.KeyEvent) in interface java.awt.event.KeyListener at line 7, column 8rn"KeyinEvent.java": Error #: 300 : class LeuomEvent not found in class character.KeyinEvent at line 32, column 3rn
为什么shell函数运行某些程序会出错?
用shell函数可以运行一些程序,,可是为什么shell函数运行某些程序会出错?
运行以下程序出错为什么?
use sxl_xxyrndeclare @fname nchar(100) rndeclare @TableName nchar(1000)rndeclare @s nvarchar(1000)rndeclare @m1 nvarchar(10)rndeclare @m2 nvarchar(10)rndeclare @m3 nvarchar(10)rndeclare @m4 nvarchar(10)rnrnset @m1=substring(cast(getdate() as char(12)),7,4)rnset @m2=substring(cast(getdate() as char(12)),4,2) rnset @m3=substring(cast(getdate() as char(12)),1,2) rnrnset @m4 =@m1+@m2+@m3rnprint @m4rnset @TableName = 'table_'+ @m4rnprint @TableNamernset @s=' if exists (select * from sysobjects where xtype=''u'' and status>=0 and name = '''+@TableName+''')'+char(13)rn set @s=@s+' drop table '+@TableName+' '+char(13)rn set @s=@s+' CREATE TABLE '+@TableName+'(用户名 varchar(20),密码 varchar(10))'rn exec(@s)rnrn
此程序为何会运行出错?
程序是在一个字符串中查找是否包含另一个较短字符串,运行时出错,不知错在哪,各位帮我看看。rnrn#includern#includern#includern#define MAX 81rn#define F 6rn#define FALSE -1rnrnchar findstr(char *p,char *q);rnchar findch(char *p,char ch);rnrnrnrnint main(void)rn char str1[MAX];rn char str2[F];rn int i=0;rnrn rn puts("Enter first string:");rn gets(str1);rn str1[80]='\0';rn puts("Enter second string:");rn gets(str2);rn str2[5]='\0';rn rnrn i=findstr(str1,str2);rn if(i==-1)printf("\nthere are no %s in the %s\n",str2,str1);rn else printf("\n the position of the %s in the %s is %d, the remain string is %s",str2,str1,i,str1[i]);rn rn return 0;rnrnrnchar findstr(char *p,char *q)rn int i,j,k;rn i=j=k=0;rn int len1,len2;rn len1=strlen(p);rn len2=strlen(q);rnrn while(i<=(len1-len2))rn j=i;rn k=0;rn while((k
以下程序在运行中出现问题,为什么?
#includernusing namespace std;rnint N;rnfloat v;rnfloat *pt1=new float[N];rnrnvoid Initiate(int M)rnrn cout<<"请输入各个系数的值:"<<"a0, a1, ..., a" <>pt1[i];rn rnrnrnfloat Compute(float pt2[],int x2)rnrn v=pt2[N];rn int k=1;rn for(int i=1;i<=N;i++)rn rn v=x2*v+pt2[N-i];rn rn return v;rnrnrnvoid main()rnrn int x1;rn cout<<"请输入未知数的值:"<>x1;rn cout<<"请输入系数的个数:"<>N;rn Initiate(N);rn Compute(pt1,x1);rn cout<
相关热词 c# 线程顺序 c#昨天当前时间 c# 多进程 锁 c#mysql图片存取 c# ocx 委托事件 c# 读取类的属性和值 c# out 使用限制 c#获取url的id c#怎么进行分页查询 c# update 集合