C++ :: Reading Information Off The Web?
Sep 9, 2013
I am building a program that will read from a particular web page. I have written it so that it will parse the page correctly, but I can only do it for a downloaded page right now. I would like for it to work simply with the URL.
I have seen things about "screen scraping", though I don't quite understand what it does - I think it's more for just parsing it, which I can already do.
If it is possible to automatically download that file, that is fine as well.
If it matters at all, the pages I am reading from are stories on Fanfiction.net.
View 1 Replies
ADVERTISEMENT
Jul 31, 2013
//---------------------------------------------------------------------------------------
//FUNCTION: vDelEditStudents()
//---------------------------------------------------------------------------------------
void vDelEditStudents() {
FILE *file = fopen("C:UserForCtxtgiro.txt", "rb");
Student StdStruct;
fseek(file, -sizeof(StdStruct) , SEEK_END);
fread(&StdStruct, sizeof(StdStruct), 1, file);
[Code] ....
The problem is that ... Even though it is reading from a a file, it is not reading a one struct. In this piece of code I'm trying to read the last struct, which should be k... The struct itself is here
Code:
typedef struct {
char StudentName[30];
uint16 StdAge;
uint16 StdNumb;
}Student;
And here is my input and output:
INPUT:
4
1 g 1 2
1 h 3 4
1 j 5 6
1 k 7 8
View 4 Replies
View Related
Apr 12, 2014
I need to read some infos out of a .txt-file.
The problem is that i dont know how to do because 'getline' won't work i think.
the file looks like this:
*******************
Inventory of MyInventory
*******************
Some info
More info
-------------------
000 Toys 6.25
a short description
126/44 Cards 2.25
some text
*******************
Inventory of MyInventory2
*******************
Some info
More info
-------------------
000 Toys 6.25
a short description
126/44 Cards 2.25
some text
So what I need to know:
- the name of the Inventory (MyInventory, MyInventory2...)
- the numbers in each row (000,126/44...)
- the name what it is (Toys,Cards...)
- the price (6.25,2.25...)
- and the description(problem here is, that there are not the same amount of words for each description)
I tried it with 'getline' but this is not working because the lines are so different each time.
View 2 Replies
View Related
Jan 10, 2013
I have a network data file that looks like this:
2476
112
213
321
426
531
634
7312
843
945
...
...
...
The first row has two values - number of nodes (24) and number of links (76). Then it has all the link details (76 rows of data). I want to read this data. I have written out the following function:
First the structure definitions:
typedef struct {
int arcno;
int tail;
int head;
} arc_data;
typedef struct {
int forwardStarPoint;
int reverseStarPoint;
[Code] .....
The code is able to read the first line of data (i.e. it displays the numNodes and numArcs as 24 and 76). But then I get a lot of errors like this one
`Access violation writing location 0xCCCCCCD8`.
The program then crashes.
View 3 Replies
View Related
Aug 15, 2013
Code to accept the information of 5 students and display the information of first 3 students......
Code:
#include<stdio.h>
main() {
struct stud {
char name[20];
int rollno;
float per;
char grade;
[Code] ....
View 6 Replies
View Related
May 21, 2014
The problem is when i run this program and program is stop working but the output is out.
#include <iostream>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <conio.h>
using namespace std;
void EnumeratePrinters(DWORD flags);
[Code] ....
View 6 Replies
View Related
Mar 27, 2013
How can I import a font file and get the pixel information of the letters so I can make my own custom text drawing function?
I basically have a pixel surface (a 2D array) and I want to draw the text to that array.
View 1 Replies
View Related
Jun 13, 2014
I am trying to transfer information of Variables. How to get this to work and everything I follow shows that this SHOULD work but some reason does NOT work... I
What I CAN get to work is if I put frm.show(); on one specific section that ONE section will show up... so I tried putting all of the variables at the end button to get them to show up with the one Frm.show and it still only does the very last one and the rest are just blank I dont really understand as to why.
Also if I put a FRM.show at each step it will just keep creating a new instance of form 2 each with a different line that is changed.
Form1 code
public Form1() {
InitializeComponent();
} public void Enter_Click(object sender, EventArgs e) {
Form2 frm = new Form2();
Employee FirstName = new Employee();
[Code] .....
Form2 Code
public partial class Form2 : Form {
public Form1 frm1;
public Form2() {
InitializeComponent();
}
View 8 Replies
View Related
Nov 13, 2014
I want to receive an information from a file. For instance, you created a file name "sample.txt" via fstream and stored a bunch of people's name, address, phone number in that "sample.txt".
Now, I want to see what's stored in this file. Suppose, I wanted some particular guys address, phone number by just typing is his/her name.
How to relate the name with address and phone number of particular people? I just started the file creating so I wanted to know about it.
#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
using namespace std;
int main() {
ofstream outputData;
[code].....
View 12 Replies
View Related
Nov 5, 2014
I am trying to use an array to keep track of the numbers of channels created and how many times a particular channel has been copied. At the moment, the program sets a number for a new channel (1-20), but the user enters the channel name. The channel name is stored in 'ChannelName' variable and if the user copies the channel, it becomes ChannelName_Copy. I want to change the '_Copy' into an incremental identifier such as _C1, _C2, etc.. and to do this i would need to keep track of the channel name and the number of times it has been copied, which i planned to do using arrays but i am not quite sure how to approach this.
View 1 Replies
View Related
Mar 12, 2013
I'm trying to add more student information to the specific txt file. I did struct my student information and separated it with an array with max size of 200.
The inside of my current file looks like
Toshi
Aka
Nonal
Donald
The first one represent student[0] and next one is student[1] and so on till student[199]. Right now, only 4 space is occupied, which means the array has information till student[3] but not from student[4] (I guess it has null condition).
What I want to do is, I want to add a new student information to student[4] and till student[199] once at each time.
So, my prompt will look like
Would like to add a new student? Y/N
(if yes goes to below statement and exit if NO)
Hi. Please enter the information of new student. ___________
Student added. Please press any key to continue.
If the key is pressed, it goes back to my initial prompt and continues till I press N.
I sure I'm not using for loop to do this thing, because I'm adding student name one by one.
However, the array is already occupied by other student name till student[3] so, I want to add a new student information to student[4] (I don't want to overwrite the current information). And if student[4] is occupied, then [5] and so on.
View 7 Replies
View Related
Jan 12, 2014
I want to take the informaition from this file and save it into a struct the file conteins name age year (in char) and a grade it is somthing like this
file
Nikos Tolis 19 A 8
Iwanna Nikolaou 20 B 9
Kwstas Doukas 20 Β 6
Georgios Pappas 19 A 7
Iwannis Lekatis 20 Β 7
Nikos Ntoumas 19 A 5
Maria Oikonomou 20 B 6
Kwstas Argyrou 19 A 10
Irw Ntouma 20 B 8
Leuteris Doukas 19 A 6
I want to read till i found the '32' the space in ascii here is my code so far
Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct students
{
char *name;
int age;
[Code] ....
View 2 Replies
View Related
Jun 25, 2014
I am doing a program that saves information on the memory and then i need to put by ascending order the student number.. but i can't get it to work...i tried with strcmp but not worked...
Code:
typedef struct {
char name[100], email[100], adress[100], postal[100], number[20];
int phone
}data; t
Then i have this to input data
Code:
void add(data* contact) {
if (i<total) {
printf("
Name: ", i + 1);
fflush(stdin);
[Code] ....
View 13 Replies
View Related
Jul 31, 2014
I am trying to parse a text file that contains information and i cant seem to get started. For example, the text file looks like this:
idx=929392, pl= 12, name= someperson
age=19
state=ma
status=n/a
idx=929393, pl= 12, name= someperson2
age=20
state=ma
status=n/a
idx=929394, pl= 12, name= someperson3
age=21
state=ma
status=n/a
I want to parse the name and age into another text file like this format:
someperson 19
someperson 20
someperson 21
possibly include other attributes next to the age like idx?
View 3 Replies
View Related
Oct 14, 2013
Directions: Write a program that uses the structure named MovieData to store the following information about a movie:
Title
Director
Year Released
Running Time
Include a constructor that allows all four of these member data values to be specified at the time MovieData variable is created. The program should create. The MovieData variable and pass each one in turn to a function that displays the information about the movie in a clearly formatted manner. Pass the MovieData Variables to the display by value.
Code:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct MovieData {
[Code] ....
I sort of hit a wall did it do something wrong because the whole create two MovieData variables is confusing me.
View 1 Replies
View Related
Nov 13, 2013
If I have a data file.dat like this, for example:
...
other information
...
physics:
4,5,6,7
...
line:
(4,2), (2,4)
line:
(1,2), (2,3)
...
...
I want to design a class and corresponding code so that every time when it reads "line:" for the file.dat , it will push_back a new line into the line_t vector, and each time when it encounter physics it will put the values to physics, How can I implement this?
every data in file.dat is useful, they need to be read into different class type. How can I implement this?
class line_t {
public:
vector<point_t> P(2, point_t());
[Code].....
View 3 Replies
View Related
Apr 20, 2015
Create a simple data file like the example shown below containing the 4 dates below plus 10 or more additional dates. The file should include 1 date per line and each date should have the form MonthNumber-DayOfTheMonth-Last2DigitsOfTheYear with no extra spaces. All dates should be in this century. No error checking for invalid dates is necessary.
My Output displays like
February -19,1991
How do I get my program to ignore the dash between the dates?
#include <fstream>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(){
const int M = 13;
[code]....
View 1 Replies
View Related
Sep 23, 2012
I used to retrieve IP and NIC information by querying windows registry. Now I'm trying to use GetAdapterAddresses() API. Using GetAdapterAddresses() to get IP is not that easy, I need to dig a long deep as I check some examples so far, anyways my question is: Calling this API will return success on all versions of Windows ie: 32bits & 64bits ?
Though Microsoft has not opened any source, where this API is actually retrieving Windows IP information.?. Is it reading Registry or some windows file.
View 6 Replies
View Related
Jan 6, 2014
Trying to get table indexes information in SQL Server 2012 I identified a strange situation for one scenarion.I have a table that contains two indexes referenced to some fields: Field_1 and Field_3 mapped over int, null columns (the number means the existing field order into the table designed few years ago...).
I am trying to get information about these indexes like this:
Code:
nRetCode = ::SQLStatistics(hstmtAux, NULL, 0, NULL, 0, (TCHAR*)(LPCTSTR)strTempTable, SQL_NTS, SQL_INDEX_ALL, SQL_ENSURE);
if (nRetCode == SQL_SUCCESS || nRetCode == SQL_SUCCESS_WITH_INFO)
{
nRetCode = ::SQLBindCol(hstmtAux, 4, SQL_C_SHORT, &swNonUnique, sizeof(SWORD), &cbNonUnique);
nRetCode = ::SQLBindCol(hstmtAux, 5, SQL_CHAR, szIdxQualif, sizeof(CHAR) * 130, &cbIdxQualif);
nRetCode = ::SQLBindCol(hstmtAux, 6, SQL_C_CHAR, szIdxName, sizeof(CHAR) * 130, &cbIdxName);
nRetCode = ::SQLBindCol(hstmtAux, 7, SQL_C_SHORT, &swType, sizeof(SWORD), &cbType);
nRetCode = ::SQLBindCol(hstmtAux, 8, SQL_C_SHORT, &swSeqInIdx, sizeof(SWORD), &cbSeqInIdx);
nRetCode = ::SQLBindCol(hstmtAux, 9, SQL_C_CHAR, szIdxColName, sizeof(CHAR) * 130, &cbIdxColName);
[code]....
Becasuse SQLExtendedFetch() is deprecated I used SQLFetchScroll() but the behavior is the same from my interest point of view.
Usally, I get the right information about indexes but in one situation I encounte a strange behavior. It's about having a clustered index into a scenario.
When Field_1 is Non-Unique, Non-Clustered and Field_3 is Clusted index I get the right information.
But if the index Field_1 is Clustered and the Field_3 is Non-Unique, Non-Clustered I get no information about Field_1 index (eg. szIdxName and szIdxColName are "" and their length is -1 that means SQL_NULL_DATA). So, I have no Index information. Within while loop, with the next iteration I get correct information about the second index Field_3.
I'm not sure whether the problem is with SQLStatistics, the bindings or SQLFetchScroll (they all always return SQL_SUCCESS). It looks like a problem with the driver when the first index is clustered.
View 6 Replies
View Related
May 18, 2013
i have written a student information storing program. it has add,delete,list,and update menu (in program i have written update == uptade,i know : P )
my question is i cant delete or update the information. where is my failure ?
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#define max 3
struct og {
char id[12];
[Code]...
View 2 Replies
View Related
May 6, 2013
my program wont output any information to the text file that I have specified it just creates it but it leaves it blank
#include <iostream>
#include<string>
#include<iomanip>
#include <fstream>
using namespace std;
class Carloan
[code]....
View 2 Replies
View Related
Feb 14, 2015
Write a C++ program to output information for three students. The information stored in your program contains student’s first name, middle name, last name, and test score. The following shows the information for the three students, where test score is in the int type.
John Jacob Smith 78
Mary Jane Weems 82
Dave Joe Dale 61
Your program should declare three named string constants for the three students. Each constant contains the student’s first name, middle name, and last name. You may use three int variables to hold values for the three test scores. The first name, middle name, and last name of a student are then extracted using the substr() function shown in class. Your program should also compute the average (in floating-point number format) for the three test scores. The average score computed should be printed to the screen with 2 digits displayed after the decimal point.
The following shows the output from the program. Note that all the output is left-justified with 15 character positions reserved for each.
first name middlename lastname testscore average
John Jacob Smith 78 73.67
Mary Jane Weems 82 73.67
Dave Joe Dale 61 73.67
View 1 Replies
View Related
Feb 6, 2014
I am trying to make a information to pointer function but the problem is how/what number am i putting in for *a...
And can i get that information back to main? and is that right way to split the array in to ? because i have will 200 random number and I need to find the smallest and second smallest element in array.
two_smallest (print, size3,size3,size3,size3);
} void two_smallest (int find_array[] , int size3, int *a, int *a2, int *b,int *b2) {
for (int index = 0; index <= 100; index ++) {
if (find_array[index] < find_array [0]) {
find_array[0] = find_array [index];
*a = find_array[0];
[Code] ....
View 1 Replies
View Related
Aug 28, 2014
I'm trying to open a file (contains member information) and store the information in an object, which is then inserted into a linked list. However, the current code just leaves a blank command window hanging with nothing happening.
main.cpp - [URL] ....
MemberProf.h - [URL] ....
MemberProf.cpp - [URL] ....
LinkedList.h -[URL] ....
View 7 Replies
View Related
Nov 23, 2013
I created a simple program that writes some text to two different text files. how to create a program that would retrieve the information from those two files, and put them in a single file, first the content of input1 and then the content of input2. how to do this. Here is the program that I created that creates the two files.
#include <iostream>
#include <fstream>
#include <string>
int main() {
using namespace std;
string input1;
ofstream fout("input1.txt");
[Code]...
View 3 Replies
View Related
Apr 4, 2014
Perhaps my original wording on this was confusing so I will ask a different way.
if I have a text file called
data.txt
and it has the following in it.
12345
67890
12345
67890
how would i read this information into an array called
int data[4][5]
This is in C.
View 10 Replies
View Related