- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
if (m_socket == INVALID_SOCKET)
{
printf("Client: socket() - Error at socket(): %ld\n", WSAGetLastError());
WSACleanup();
return EXIT_SUCCESS;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Этот поиск практически ничего не может найти! Но вы всё-таки попытайтесь, вдруг повезет.
Найдено: 35
+140
if (m_socket == INVALID_SOCKET)
{
printf("Client: socket() - Error at socket(): %ld\n", WSAGetLastError());
WSACleanup();
return EXIT_SUCCESS;
}
Лаба знакомого о сетям.
Очень, блин, SUCCESS!
+169
#include <iostream>
#include <cstdlib>
#include "filesdescrtable.h"
int ___cntr = 0;
#define _(X) if((X) == EXIT_SUCCESS) {___cntr++;} else {std::cerr << "error on operator: " << ___cntr << std::endl; return (EXIT_FAILURE);}
int main (int argc, char *argv[]) {
FilesDescrTable a;
int d1,d2,d3;
_(a.setAutoReport(true));
_(a.openFile(argv[1], O_RDWR | O_CREAT, 0600, d1));
_(a.openFile(argv[2], O_RDWR | O_CREAT, 0600, d2));
_(a.openFile(argv[3], O_RDWR | O_CREAT, 0600, d3));
_(a.clearFile(argv[3]));
_(a.cpy(d3,d2));
_(a.closeFile(d1));
_(a.closeFile(d2));
_(a.closeFile(d3));
return(EXIT_SUCCESS);
}
хитрый макрос для отлова ошибок. такой хитрый
+166
#include "stdafx.h"
#include <iostream>
#include <locale>
#include <conio.h>
typedef unsigned short int g;
int main()
{
g b=0;g m=1;
std::wcout.imbue(std::locale(".866"));
for(g i=0;m==1;i++)
{
try
{
std::wcout<<L"Введите столбец по которому надо сортировать(меньше 10)";
std::cin>>b;m=0;
}
catch(...){m=1;}
}
return EXIT_SUCCESS;
}
http://www.cyberforum.ru/cpp/thread550.html
"Здравствуйте! мне надо чтобы если юзер вводит неверные данные ему было предложено вновь ввести данные заново.Почему этого не происходит"
+138
static const char*const nullp,From_[]=FROM,exflags[]=RECFLAGS,
drcfile[]="Rcfile:",pmusage[]=PM_USAGE,*etcrc=ETCRC,
misrecpt[]="Missing recipient\n",extrns[]="Extraneous ",ignrd[]=" ignored\n",
pardir[]=chPARDIR,curdir[]={chCURDIR,'\0'},
insufprivs[]="Insufficient privileges\n",
attemptst[]="Attempt to fake stamp by";
char*buf,*buf2,*loclock,*tolock;
const char shell[]="SHELL",lockfile[]="LOCKFILE",newline[]="\n",binsh[]=BinSh,
unexpeof[]="Unexpected EOL\n",*const*gargv,*const*restargv= &nullp,*sgetcp,
pmrc[]=PROCMAILRC,*rcfile=pmrc,dirsep[]=DIRSEP,devnull[]=DevNull,
lgname[]="LOGNAME",executing[]="Executing",oquote[]=" \"",cquote[]="\"\n",
procmailn[]="procmail",whilstwfor[]=" whilst waiting for ",home[]="HOME",
host[]="HOST",*defdeflock,*argv0="",errwwriting[]="Error while writing to",
slogstr[]="%s \"%s\"",conflicting[]="Conflicting ",orgmail[]="ORGMAIL",
exceededlb[]="Exceeded LINEBUF\n",pathtoolong[]=" path too long";
char*Stdout;
int retval=EX_CANTCREAT,retvl2=EXIT_SUCCESS,sh,pwait,lcking,rcstate,rc= -1,
ignwerr,lexitcode=EXIT_SUCCESS,asgnlastf,accspooldir,crestarg,skiprc,
savstdout,berkeley,mailfilter,erestrict;
size_t linebuf=mx(DEFlinebuf+XTRAlinebuf,1024/*STRLEN(systm_mbox)<<1*/);
volatile int nextexit; /* if termination is imminent */
pid_t thepid;
long filled,lastscore; /* the length of the mail, and the last score */
char*themail,*thebody; /* the head and body of the mail */
uid_t uid;
gid_t gid,sgid;
Источник: http://opensource.apple.com/source/procmail/procmail-1.2/procmail/src/procmail.c
+152
#include <fstream>
using namespace std;
#define ES EXIT_SUCCESS
#define FOR(i___,___n) for (int i___=0; i___<(int)___n; i___++)
#define RFOR(i__,__n,_n) for (int i__=__n; i__>=_n; i__--)
#define or(i__,__s) fstream i__((char*)__s)
#define ow(i__,__s) ofstream i__((char*)__s)
#define MEM(a,b) a=new char[b]
#define MEM1(a,b) a=new char*[b]
#define RFOR1(i__,_i,__n,_n) for (int i__=__n, _i=_n; i__>=_n; i__--,_i++)
int N,L,D;
char **F, *W;
int main()
{
or(in,"input.txt"); ow(out,"output.txt");
in>>N>>L>>D;
MEM(W,N),MEM1(F,N+1), in.get();
FOR(i,N-L+1) W[i]='0';
FOR(i,L) W[N-L+i]=in.get();
FOR(i,N+1) MEM(F[i],2), F[i][0]=F[i][1]=0;
F[0][0]=1;
RFOR1(j,i,N-1,0)
if (W[j]=='0')
F[i+1][1]=F[i][1], F[i+1][0]=(F[i][0] + F[i][1])%D;
else
F[i+1][1]=(F[i][1] +F[i][0])%D, F[i+1][0]=F[i][0];
out<<(int)F[N][0];
return ES;
}