这是我的代码(C ++)。
jQuery(document).scroll(function() {
var documentTop = jQuery(document).scrollTop();
console.log('this is current top of your document' + documentTop );
//box top is 891
if (documentTop > 841) {
//change the value of the css at this point
jQuery("#box").addClass("stayfix");
}
else
{
jQuery("#box").removeClass("stayfix");
}
});
请注意#include <iostream>
#include <fstream>
#include <cstdlib>
#include <sstream>
using namespace std;
void rotaryxorencrypt(int dat[],int len){
------------------------------
}
void encrypt(int dat[],int len){
rotaryxorencrypt(dat,len);
}
void decrypt(int dat[],int len){
}
int main() {
fstream file;
fstream *fileptr=&file;
file.open("tmp",ios::in);
string line;
string *lineptr=&line;
int x;
int *xptr=&x;
int cont=0;
int *contptr=&cont;
int len;
int *lenptr=&len;
stringstream ss;
stringstream *ssptr=&ss;
string cryption;
string *cryptionptr=&cryption;
getline(*fileptr,*lineptr);
try{
if(*lineptr=="encryption"){
*cryptionptr="encrypt";
}else if(*lineptr=="decrypt"){
*cryptionptr="decryption";
} else {
cout<<"Unknown Cryptography Type - "<<*lineptr<<endl;
throw 0;
}
getline(*fileptr,*lineptr);
*ssptr<<*lineptr;
*ssptr>>*xptr;
ss.str("");
ss.clear();
*lenptr=*xptr;
int *dataptr;
dataptr=new int[*lenptr];
cout<<"Loading Formatted Data"<<endl;
while ( getline (*fileptr, *lineptr) ) {
*ssptr<<*lineptr;
*ssptr>>*xptr;
ss.str("");
ss.clear();
dataptr[cont]=*xptr;
cont++;
}
file.close();
delete lineptr;
delete xptr;
delete contptr;
delete ssptr;
delete fileptr;
------------------
if(*cryptionptr=="encrypt"){
cout<<"Beginning Encryption Process."<<endl;
cout<<dataptr[0]<<endl;
encrypt(dataptr,len);
cout<<dataptr[0]<<endl;
cout<<"Outputting Encrypted Data."<<endl;
}else if(*cryptionptr=="decrypt"){
cout<<"Beginning Decryption Process."<<endl;
decrypt(dataptr,len);
cout<<"Outputting Decrypted Data."<<endl;
}
cout<<"Clearing Cache."<<endl;
delete []dataptr;
delete cryptionptr;
delete lenptr;
}catch(int x){
if(x==0){
cout<<"Clearing Cache."<<endl;
delete fileptr;
delete lineptr;
delete xptr;
delete contptr;
delete ssptr;
delete fileptr;
}else{
cout<<"Unknown Error - Cannot Clear The Cache."<<endl;
}
}
cout<<"here"<<endl;
return 0;
cout<<"here"<<endl;
}
之前和之后的cout<<"here"<<endl;
。没有它们我有同样的问题,所以它们不是问题,但它会执行第一个return 0;
但会在第二个之前崩溃。如果我删除第二个,它会做同样的事情,如果我删除第一个它只是崩溃,因此它崩溃在cout<<"here"<<endl;
。为什么会发生这种情况。 (PS这是另一个加密项目的一部分(可能敏感部分[不是崩溃点或代码错误]变成了“-----------------”(这不是实际的)码)。
答案 0 :(得分:3)
删除所有指针和所有delete
。此处没有使用new
创建任何内容,因此无需删除任何内容。好的,应该删除dataptr
。但是在所有解除引用的噪音中很难找到。