No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
35 Posted Topics
Hi, I have data coming over a socket that looks like this [code] (h)(int,char,float,int,char)(/h)(d)(2,a,1.32,45,d)(3,d,3.45,32,a)(/d) [/code] the datatype of the data arriving is dynamic and is only known when the header is received.I then have to create corresponding vectors(stl) to store the data. In this case, 2 int,2 char and one … | |
Hi, Here's my scenario. I am given records and the datastructure of each column in the records at runtime. A sample looks like this, [code] char[] | int16 | int32 | double abcd | 2 | 96 | 1024 ghi | 3 | 104 | 2048 [/code] I cannot predefine … ![]() | |
Hi, I have a string that looks like this \\x\\y\\z-Select * from x where y=z I need to split this at the '-' into two strings. When I use substr as, [code] string s = "\\x\\y\\z-Select * from x where y=z"; size_t p = s.find("-"); if(p!=string::npos) string query = s.substr(p+1); … | |
Hi, I have a struct that looks like this [code] struct Info { char **field_names; double **data; int *cindex; } [/code] I have to serialize an object of this struct and send it over a socket and deserialize at the other end. What is the best option for this? | |
Hi, I have a situation I need help with. I have c++ s/w from two vendors each of whom have given me a library and a header. Only problem is that one of them is compiled with vc++ and the other with g++.I cant use them both in the same … | |
Hi. I have a character array of the form "0abcdef" or "1defghi". I have to remove the first character and convert the rest to a string. So in this case, the strings would be abcdef and defghi. I know that saying string s(char array) does a direct conversion but I … | |
I'm getting this error at the end of my program... [code] *** glibc detected *** ./a.out: free(): invalid pointer: 0x00617ca0 *** ======= Backtrace: ========= /lib/libc.so.6[0x684ac1] /lib/libc.so.6(cfree+0x90)[0x6880f0] /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xc986f1] ./a.out[0x804ce2f] ./a.out[0x804973d] /lib/libc.so.6(__libc_start_main+0xe0)[0x631390] ./a.out(__gxx_personality_v0+0x7d)[0x8048de1] ======= Memory map: ======== 00110000-00111000 r-xp 00110000 00:00 0 [vdso] 005fc000-00617000 r-xp 00000000 08:01 687043 /lib/ld-2.7.so 00617000-00618000 r-xp 0001a000 … | |
Hi, I'm not clear as to when memory is allocated from the stack, free store or data area.Can someone please elaborate? | |
Hi, I need an array of approx. 2,00,000 elements.But malloc fails to allocate beyond 65872. When I give (short int*)malloc(sizeof(short int)*65000); It works but seg faults when I give (short int*)malloc(sizeof(short int)*66000); whatsup with that? | |
Hi, Here's my code [code] #include<iostream> #include<fstream> #include<string.h> #include<math.h> #include<stdlib.h> #include<stdio.h> using namespace std; int cIndex(char *x,char **featlist,int len) { int i; for(i=0;i<len;i++) if(strcmp(x,featlist[i])==0) return i; } int main(int argc,char *argv[]) { std::ifstream featFile(argv[1],ios::in); std::ifstream trainFile(argv[2],ios::in); // std::ofstream svmFile(argv[3],ios::out); char line[20000]; char feat[100]; char **featlist; int i=0,len=0,fl=0,j; char* x; int … | |
Hi, I'm implementing kd trees and have pseudo code for most of the functions but the delete operation.Its quite complicated and I have no idea how to implement it.Any help is appreciated | |
Hi, I'm new to php.I had to include common content to a lot of webpages in my website like menubar etc. and i was told i could load them dynamically from a single file using php.Can someone help me with this? | |
I have a code snippet that strangely works one way on a fedora 6 machine and another way on a fedora 8 machine. [code] void Form1::SendToApp() { vector<int> isciistream; vector<int> fontstream; cout<<"Entering Form1::SendToApp()"<<endl; isciistream=wwnd->OnOK(); isciistream.push_back(32); char str[255]=""; cout<<"Size of IsciiStream:"<<isciistream.size()<<endl; for (int i=0;i<(int)isciistream.size();i++) { sprintf(str,"%s%c",str,isciistream[i]); cout << "isciistream[i] :" << … | |
Hi, I've got a program that I wish to run in a powerful server so that it can run on several cores simultaneously and work faster.I need to do client server programming for this.That is, I recieve input in my local system which I forward to the server, it does … | |
I have a c++ program that performs a functionality. generate.h [code] struct code { bool out; bool *reg; }; class Cyclic { private: struct code *cy; int rgsize; bool *gen; int gensize; unsigned short cycodes[256]; public: Cyclic(int a, int b,bool c[]); void leftShift(); bool* cyclicCode(bool mssg[],int msize); void printReg(); bool* … | |
Hi, In an assignment I'm supposed to introduce packet errors and bit erasures in the packets.packet errors I can do.Bit erasures mean we have no idea if its a 1 or a 0.how can I introduce something other than a 0 or a 1 in a bit? | |
hey..I need to convert a 8 value bool array to char.How can I do this? | |
Hi, I need help with implementing cyclic codes.Its much like crc.I've found a lot of software implementations for crc but havent understood them.I've looked at a crc guide which gave, [code] So to implement CRC division, we have to feed the message through a division register. At this point, we … | |
Hi, I want to transfer a file as it is via a socket...not read the file contents and send it.How can I do this? | |
Hi, I need to write C++ code to find the factors of a polynomial.For eg. X^2-1 should return x-1 and x+1...anyone have any ideas on how to do this? | |
Hi, I'm implementing linear block coding and need some ideas on how to go about storing the cosets. i.e. If i have an alphabet C={000,101,010,111} I need to perform C+000={000,101,010,111} C+001={001,100,011,110} C+010={010,111,000,101} C+011={011,110,001,100} etc... observed here is that there are only 2 sets and it keeps repeating.So, i need to … ![]() | |
Hi, We are doing some audio data collection.So I need to write a program which when run would generate a beep and record from a microphone until the next beep and save it as a wave file.This repeats for n beeps with a gap of 5 seconds between beeps. Can … | |
Hi, Thanks to everyone I was able to submit my huffman coding assignment successfully.Now I've got to do arithmetic coding and it seems really confusing.I've looked at arturo campos's page [URL="http://www.arturocampos.com/ac_arithmetic.html"]http://www.arturocampos.com/ac_arithmetic.html[/URL] and havent understood using the range 0000h to ffffh instead of [0,1) and adjusting probabilities to be limited to … | |
I'm reading a file and I'd like to get short,int etc. apart from the usual char because I want to read 16 bit values...is there a way? | |
Hi, Whenever a user types ./a.out with the wrong number of arguments I want my program to output something like Usage: ./a.out <-e/-d> <FIlename> <Value> how can I do this? | |
Hi, In a function of my program, I open and close the file once every recursion...and the recursion is very large....I've made sure im not writing when its closed or not opening when its open or any of those trivial issues.Will this be a problem with the operating system?...because I'm … | |
hi, I've completed huffman coding..but there is one small issue...in my decoded file the character "ΓΏ" keeps appearing at random places...I checked the problem and a second parse of the input file gives some characters that are not in my tree which ends up adding a code 0 of length … | |
hi, This is a doubt about the pseudo-eof.If i have an 8 bit system, Then the pseudo eof has to be above 8 bits...so should i allocate 16 bits for every character just so that my eof can exist?..if its a 16 bit system I have to use 24 bits? | |
Hi, Lets assume my preorder traversal gives me a unique tree.How do I get the tree from the preorder traversal? Any help is appreciated | |
Hi, I've coded huffman coding.I've formed my codebook.Its correct upto that point.I'm using unsigned int(32 bits) and packing the codes into it and writing to file whenever 32 bits get filled.Somehow..my resultant file is larger than my source file.Am i doing something wrong? | |
Hi, My doubt is that..lets say we have an usigned int.If I do a left shift by 32 bits...I'm getting back the original one..shouldnt it be all zeros?? | |
Hi, I'm trying to code Huffman coding.I've formed my huffman tree but dont understand how I'm gonna assign bits to it.How do I do bit operations and how do i maintain bits of length 3,5 etc? Any help appreciated | |
Hi, I need to implement a dynamic array of pointers to structures.Here's what I've done [code] struct node{ int freq; node *lptr; node *rptr; }; class M { private: node **A; int length; public: M() { length=10; A=new node*[10]; } M(int a) { length=a; A=new node*[a]; } [/code] Firstly, am … | |
I need to code a linked binary min heap.Everywhere I go its an array based min heap..can someone direct me to some pseudocode for a linked min heap? Thanks for any help | |
Hi, Here's my situation.I'm reading a file that consists of characters including white space.Once I read them I'm counting the occurrences of each character.This means I need to count occurrences of white space as well.If I use ifstream I skip the white spaces and I dunno the filesize so I … |
The End.