I want to increase the number of characters the user enters as the text (refer line 1410 of cpp file). I want it to be infinite, if possible. Tks.
uompearl 0 Newbie Poster
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <windows.h>
#include <string.h>
#include <memory.h>
#include <process.h>
#include <tchar.h>
#include <dos.h>
#include <conio.h>
#include <fstream>
#include <string>
# include <bitset>
using namespace std;
#include <time.h>
double start_time,stop_time;
double mictime,mictime2,micheader1time,micheader2time,cbcmactime,;
double ctrpreloadtime,ctrtime,totctrtime;
double totenctime, throughput;
int numblock,remainder,remainblock,block,length;
/* Special globals for NT performance timers */
double freq;
long start;
/* Initialize everything to 0 */
void sec_init(void)
{
LARGE_INTEGER lFreq, lCnt;
QueryPerformanceFrequency(&lFreq);
freq = (double)lFreq.LowPart;
QueryPerformanceCounter(&lCnt);
start = lCnt.LowPart;
}
/* return number of seconds since sec_init was called with
** a gross amount of detail
*/
double sec(void)
{
LARGE_INTEGER lCnt;
long tcnt;
QueryPerformanceCounter(&lCnt);
tcnt = lCnt.LowPart - start;
return ((double)tcnt) / freq;
}
/* End of NT special stuff */
/*****************************************/
/* Algorithm behaviour options */
/* Enable or disable these options to */
/* modify the behaviour of the algorithm */
/*****************************************/
/* Reverses PN order in MIC to match on air PN order. */
/* This is not standard behaviour in draft 3.0 but */
/* may become so in the future. */
/*
#define CONSISTENT_PN_ORDER
*/
/****************************************/
/* Text output options. */
/* Comment out to reduce text output */
/****************************************/
/* Either enable this define for standard output */
#define SHOW_TGI_DRAFT_TEXT
/* Or enable any selection of the following for diagnostic output
#define SHOW_PHASES
#define SHOW_TESTCASE_NUM
#define SHOW_PARSING_TITLE
#define SHOW_HEADER_FIELDS
#define SHOW_HEADER
#define SHOW_RSN_HEADER
#define SHOW_INIT_BLOCKS
#define SHOW_CTR_PRELOAD
#define SHOW_MIC
#define SHOW_DATA
#define SHOW_CRC
#define SHOW_PASSFAIL
*/
/********************************/
/* 802.11 FC subfield encodings */
/********************************/
#define MANAGEMENT_FRAME 0
#define CONTROL_FRAME 1
#define DATA_FRAME 2
#define RESERVED_FRAME 3
#define QOS_DATA 8
#define QOS_NULL 12
int test_case_length[] = {41, 41, 47, 49, 43, 41, 110, 54, 54, 34};
int test_case_defkeyid[] = {2,3,0,0,0,2,2,1,1,0};
#ifdef CONSISTENT_PN_ORDER
unsigned char test_case_crc[] = {
0x6d,0xe3,0x66,0x48,
0x9c,0x8b,0x0f,0xbc,
0x15,0xed,0x14,0x42,
0x8e,0xd3,0x49,0x64,
0xf6,0x64,0x84,0x8a,
0x69,0x9a,0x35,0x30,
0xcb,0x70,0x50,0x5c,
0x7d,0x08,0x2a,0x25,
0xa9,0x8b,0x4b,0xda,
0xd0,0xf6,0x2f,0x9e
};
#else
unsigned char test_case_crc[] = {
0x94,0x8a,0x40,0x43,
0x65,0xe2,0x29,0xb7,
0x70,0x5a,0xd4,0x12,
0x61,0x99,0xed,0xcf,
0x03,0x24,0xe4,0x52,
0x22,0x1a,0xcc,0x8a,
0xcd,0x51,0x23,0x67,
0x60,0xbc,0xba,0x79,
0xcb,0x69,0x37,0x92,
0xf3,0x21,0x63,0x01
};
#endif
unsigned long int test_case_pnl[] = { /* least significant 4 bytes of pn */
0x04030201,
0x04030201,
0x00000001,
0x00000001,
0x00000001,
0x04030201,
0x04030201,
0x00000001,
0x00000001,
0x00000001
};
unsigned long int test_case_pnh[] = {
0x0605,
0x0605, /* most significant 2 bytes of pn */
0x0000,
0x0000,
0x0000,
0x0605,
0x0005,
0x0000,
0x0000,
0x0000
};
unsigned char keys[] =
{
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0xc9,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x98,0x3a,0x16,0xef,0x4f,0xac,0xb3,0x51,0xaa,0x9e,0xcc,0x27,0x1d,0x73,0x09,0xe2,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf
};
unsigned char test_cases[] = /* Test Case 1 */
{
0x08,0x01,0x01, /* FC */
0x02,0x01, /* Duration */
0x00,0x06,0x25,0xa7,0xc4,0x36, /* A1 */
0x00,0x02,0x2d,0x49,0x97,0xb4, /* A2 */
0x00,0x06,0x25,0xa7,0xc4,0x36, /* A3 */
0xe0,0x00, /* SC */
/* Payload */
0xaa,0xaa,0x03,0x00,0x00,0x00,0x88,0x8e,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,
};
/***************************************/
/********* Table for CRC 32 ************/
/***************************************/
unsigned char lookahead_table[1024] =
{
0x00,0x00,0x00,0x00,0x96,0x30,0x07,0x77,0x2c,0x61,0x0e,0xee,0xba,0x51,0x09,0x99,
0x19,0xc4,0x6d,0x07,0x8f,0xf4,0x6a,0x70,0x35,0xa5,0x63,0xe9,0xa3,0x95,0x64,0x9e,
0x32,0x88,0xdb,0x0e,0xa4,0xb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xe4,0x61,0xce,
0x0e,0xf9,0xde,0x5e,0x98,0xc9,0xd9,0x29,0x22,0x98,0xd0,0xb0,0xb4,0xa8,0xd7,0xc7,
0x17,0x3d,0xb3,0x59,0x81,0x0d,0xb4,0x2e,0x3b,0x5c,0xbd,0xb7,0xad,0x6c,0xba,0xc0,
0x20,0x83,0xb8,0xed,0xb6,0xb3,0xbf,0x9a,0x0c,0xe2,0xb6,0x03,0x9a,0xd2,0xb1,0x74,
0x39,0x47,0xd5,0xea,0xaf,0x77,0xd2,0x9d,0x15,0x26,0xdb,0x04,0x83,0x16,0xdc,0x73,
0x12,0x0b,0x63,0xe3,0x84,0x3b,0x64,0x94,0x3e,0x6a,0x6d,0x0d,0xa8,0x5a,0x6a,0x7a,
0x0b,0xcf,0x0e,0xe4,0x9d,0xff,0x09,0x93,0x27,0xae,0x00,0x0a,0xb1,0x9e,0x07,0x7d,
0x44,0x93,0x0f,0xf0,0xd2,0xa3,0x08,0x87,0x68,0xf2,0x01,0x1e,0xfe,0xc2,0x06,0x69,
0x5d,0x57,0x62,0xf7,0xcb,0x67,0x65,0x80,0x71,0x36,0x6c,0x19,0xe7,0x06,0x6b,0x6e,
0x76,0x1b,0xd4,0xfe,0xe0,0x
Agni 370 Practically a Master Poster Featured Poster
>I want it to be infinite, if possible
Do you have infinite storage capacity?
uompearl 0 Newbie Poster
i mean maximum number of characters possible.
Narue 5,707 Bad Cop Team Colleague
>I want it to be infinite, if possible.
Then you need to write something that can build a buffer of variable length from chunks returned by _cgets (_cgets_s in this case because you want length checking):
std::string console_read()
{
std::string result;
char buffer[82];
std::size_t nread;
while ( _cgets_s ( buffer, &nread ) == 0 )
result += buffer;
return result;
}
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.