Click here to Skip to main content
14,833,762 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to send huge data via sockets in continuous intervals Pin
leon de boer23-May-16 5:41
Memberleon de boer23-May-16 5:41 
GeneralRe: How to send huge data via sockets in continuous intervals Pin
manoharbalu24-May-16 1:57
Membermanoharbalu24-May-16 1:57 
GeneralRe: How to send huge data via sockets in continuous intervals Pin
leon de boer24-May-16 4:01
Memberleon de boer24-May-16 4:01 
GeneralRe: How to send huge data via sockets in continuous intervals Pin
manoharbalu24-May-16 20:44
Membermanoharbalu24-May-16 20:44 
GeneralRe: How to send huge data via sockets in continuous intervals Pin
leon de boer25-May-16 22:08
Memberleon de boer25-May-16 22:08 
SuggestionRe: How to send huge data via sockets in continuous intervals Pin
David Crow23-May-16 3:41
MemberDavid Crow23-May-16 3:41 
AnswerRe: How to send huge data via sockets in continuous intervals Pin
Joe Woodbury25-May-16 6:42
professionalJoe Woodbury25-May-16 6:42 
QuestionInput multiple data types from a file into a linked list Pin
Farhan_Karim20-May-16 17:51
MemberFarhan_Karim20-May-16 17:51 
i am working on a movie database and i have output from my file that i want to load into my linked list,no problem opening file but when i run this function it enters junk values in the list and only works if i enter all the strings without spaces or seperated by special characters.

i am reading this from the txt file
SHAWSHANK REDEMPTION 120 5 MYSTERY 2009 ENGLISH 3
THE MATRIX 120 5 MYSTERY 2009 ENGLISH 3
THE MATRIX PART1 120 5 MYSTERY 2009 ENGLISH 3
THE MATRIX PART2 120 5 MYSTERY 2009 ENGLISH 3

this is the code for load text from file into a linkedlist(doubly)
void double_llist::loadfromfile(){

    string mname,mgenre,mlanguage;
    int mrelease_year,mamount, mrating,mruntime;
        ifstream fromfile;
        fromfile.open("database.txt");
        while (fromfile >> mname >> mgenre >> mlanguage >> mrelease_year>>mamount>>mrating>>mruntime)
    {
        /* do something with name, var1 etc. */
        cout << mname<<mgenre<<mlanguage<<mrelease_year<<mamount<<mrating<<mruntime<<endl;
    create_list(mname,mgenre,mlanguage,mrelease_year,mamount,mrating,mruntime);
    }
}


the code for doublylinkedlist

void double_llist::create_list(string mname,
    string mgenre,
    string mlanguage,
    int mrelease_year,
    int mamount,
    int mrating,int mruntime)
{

    struct node *s, *temp;
    temp = new(struct node);
    temp->info=id++;
    temp->name = mname;
    temp->genre=mgenre;
    temp->language=mlanguage;
    temp->release_year=mrelease_year;
    temp->amount=mamount;
    temp->rating=mrating;
    temp->runtime=mruntime;
    temp->next = NULL;
    if (start == NULL)
    {
        temp->prev = NULL;
        start = temp;
    }
    else
    {
        s = start;
        while (s->next != NULL)
            s = s->next;
        s->next = temp;
        temp->prev = s;
    }
}


my class and node struct for linkedlist

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<fstream>
/*
 * Node Declaration
 */
using namespace std;
struct node
{
    int info;
    string name;
    string genre;
    string language;
    int release_year;
    int amount;
    int rating;
    int runtime;
    struct node *next;
    struct node *prev;
    static int counter;
}*start;
int id=1;
/*
 Class Declaration
 */
class double_llist
{
    public:

        void create_list(string mname,
    string mgenre,
    string mlanguage,
    int mrelease_year,
    int mamount,
    int mrating,int mruntime);
        void delete_element(int value);
        void search_element(node *head, int value);
        void display_dlist();
        void sorting();
       void update(node *q ,int value);
        int count();
        void reverse();
        void savetofile();
        void loadfromfile();
        void revertsort();
        double_llist()
        {
            start = NULL;

        }
};

AnswerRe: Input multiple data types from a file into a linked list Pin
Richard MacCutchan20-May-16 21:54
mveRichard MacCutchan20-May-16 21:54 
GeneralRe: Input multiple data types from a file into a linked list Pin
Farhan_Karim20-May-16 22:08
MemberFarhan_Karim20-May-16 22:08 
GeneralRe: Input multiple data types from a file into a linked list Pin
Richard MacCutchan20-May-16 22:30
mveRichard MacCutchan20-May-16 22:30 
GeneralRe: Input multiple data types from a file into a linked list Pin
leon de boer22-May-16 4:00
Memberleon de boer22-May-16 4:00 
QuestionRe: Input multiple data types from a file into a linked list Pin
David Crow21-May-16 14:45
MemberDavid Crow21-May-16 14:45 
QuestionIs it good practice for a beginner C++ coder to use autocomplete? Pin
Member KL20-May-16 10:16
MemberMember KL20-May-16 10:16 
SuggestionRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
David Crow20-May-16 10:26
MemberDavid Crow20-May-16 10:26 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Albert Holguin20-May-16 13:10
professionalAlbert Holguin20-May-16 13:10 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Richard MacCutchan20-May-16 21:40
mveRichard MacCutchan20-May-16 21:40 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Albert Holguin22-May-16 8:40
professionalAlbert Holguin22-May-16 8:40 
AnswerRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Albert Holguin20-May-16 13:13
professionalAlbert Holguin20-May-16 13:13 
AnswerRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Patrice T20-May-16 19:24
mvePatrice T20-May-16 19:24 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Albert Holguin22-May-16 8:43
professionalAlbert Holguin22-May-16 8:43 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Patrice T22-May-16 8:50
mvePatrice T22-May-16 8:50 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Albert Holguin22-May-16 8:54
professionalAlbert Holguin22-May-16 8:54 
GeneralRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Patrice T22-May-16 8:56
mvePatrice T22-May-16 8:56 
AnswerRe: Is it good practice for a beginner C++ coder to use autocomplete? Pin
Krishnakumartg21-Sep-16 19:38
MemberKrishnakumartg21-Sep-16 19:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.