In this tutorial, similarly to the Comma Adder Tutorial, we will be reading in data and then modifying it for output into another file.
However, this time, there will be another file of data that we will compare it with. We will remove duplicates from our output, and we will keep track of those duplicates and output them to another file. So, if our input for the first file is this:
1234567
2345678
3456789
and our input from the second file is this (I've colored the duplicate blue):
8573968
3958396
1234567
3058376
Our first output file will be this (with duplicate(s) removed):
2345678
3456789
and our second output file will be this (the duplicate(s)):
1234567
*** View this blog with HTTP instead of HTTPS to see the code formatted nicely. ***
Showing posts with label file. Show all posts
Showing posts with label file. Show all posts
Sunday, March 24, 2013
Thursday, March 7, 2013
Comma Adder
In a similar fashion to my 2 previous tutorials:
http://thecodingtutorials.blogspot.com/2013/01/simple-file-manipulation-in-console.html
http://thecodingtutorials.blogspot.com/2013/01/character-arrays-in-c.html
This tutorial will show a C++ program that takes input from a file called "input.txt" and outputs it to "output.txt", only this time, it will take input like this:
1234567
1234567
1234567
and output it with commas after the third digit on each line like this:
123,4567
123,4567
123,4567
http://thecodingtutorials.blogspot.com/2013/01/simple-file-manipulation-in-console.html
http://thecodingtutorials.blogspot.com/2013/01/character-arrays-in-c.html
This tutorial will show a C++ program that takes input from a file called "input.txt" and outputs it to "output.txt", only this time, it will take input like this:
1234567
1234567
1234567
and output it with commas after the third digit on each line like this:
123,4567
123,4567
123,4567
Monday, January 28, 2013
Character Arrays in C++
This tutorial will show you how to use char (character) arrays in c++. In case you don't know, in the coding world there are strings of text, e.g.:
"Hello world!"
and these strings can be divided into arrays of characters:
'H' + 'e' + 'l' + 'l' + 'o' + ' ' + 'w' + 'o' + 'r' + 'l' + 'd' + '!'
Each character within a string, file, network packet, or etc. can easily be accessed individually if you use a character array:
charArray[0] == 'H'
charArray[1] == 'e'
etc...
In this tutorial, we will be making a program that will read an input file (which is expected to be a series of phone numbers separated by commas), go through each character in the file and make some changes, and then output the result to another file.
"Hello world!"
and these strings can be divided into arrays of characters:
'H' + 'e' + 'l' + 'l' + 'o' + ' ' + 'w' + 'o' + 'r' + 'l' + 'd' + '!'
Each character within a string, file, network packet, or etc. can easily be accessed individually if you use a character array:
charArray[0] == 'H'
charArray[1] == 'e'
etc...
In this tutorial, we will be making a program that will read an input file (which is expected to be a series of phone numbers separated by commas), go through each character in the file and make some changes, and then output the result to another file.
Wednesday, January 16, 2013
Simple File Manipulation in a Console Application with C++
1234567
1234567
1234567
and output it to a file called "output.txt" that is formatted like this (standard CSV (Comma Separated Values) format, except with 25 columns per row maximum):
1234567,1234567,1234567,...(25 times)
1234567,1234567,1234567,...(25 times)
1234567,1234567,1234567,...(18 times)
Creating an Empty C++ Console Application in Visual Studio 2010
Tuesday, July 31, 2012
Using CSV (and Text) Files with D3
This tutorial is in response to a request by someone who wanted to know how to use data from CSV (Comma Separated Values) files with D3. Interestingly enough, you will also see how the data can be stored into and read from a simple text file (instead) along the way.
The CSV file format is commonly used in spreadsheets, and it's pretty well known to programmers as one of the easiest formats to read and write data with. Why? Take a look at what a CSV file's contents could be:
Before I show you how to use CSV, you should know that I made an "Introduction to D3" tutorial earlier. I highly recommend that you read it first.
The CSV file format is commonly used in spreadsheets, and it's pretty well known to programmers as one of the easiest formats to read and write data with. Why? Take a look at what a CSV file's contents could be:
2345, 345, sdfgsd, 3453,If you look past the stupidity of the bogus "data" I used in that example, you'll see that it's fairly simplistic! Every value is separated by a comma - hence, Comma Separated Values (CSV).
wgdg, 34, fsg, dgd, 34534.634,
sfsfggsdfgsdfgsdfh, 4, "hello",
-2
Before I show you how to use CSV, you should know that I made an "Introduction to D3" tutorial earlier. I highly recommend that you read it first.
Tuesday, March 27, 2012
Setting up and using FTP
FTP, or File Transfer Protocol, is a means of being able to transfer files from one computer to another. Usually FTP is used for transferring files to and from web servers. It is one of my favorite methods of uploading websites, scripts, files, and etc.
FTP uses a client and server program. The server program listens and waits for incoming client connections, and once a connection is established the two computers can communicate with each other and transfer files back and forth. A client program is needed to interact with the server (from a website designer/developer/manager's perspective) and upload/download files.
My favorite FTP client is FileZilla (note: FileZilla also provides a server program, but we're not going to be using that in this tutorial). It's free and it can do everything you would want to do with an FTP client - I've also never experienced any bugs or any other problems (that were not my own fault).
First, go to the FileZilla website to download the client program:
http://filezilla-project.org/
FTP uses a client and server program. The server program listens and waits for incoming client connections, and once a connection is established the two computers can communicate with each other and transfer files back and forth. A client program is needed to interact with the server (from a website designer/developer/manager's perspective) and upload/download files.
My favorite FTP client is FileZilla (note: FileZilla also provides a server program, but we're not going to be using that in this tutorial). It's free and it can do everything you would want to do with an FTP client - I've also never experienced any bugs or any other problems (that were not my own fault).
First, go to the FileZilla website to download the client program:
http://filezilla-project.org/
Thursday, March 22, 2012
Adding a subdomain to your website
Subdomains allow you to denotate to your website visitors that they are viewing a particular section of your website. An example of a subdomain would be mail.google.com. "mail" is a subdomain of "google.com", with a period in between. Generally, subdomains will have a folder on the same server as the main website for all of the subdomain's files.
This tutorial will show how to add a subdomain to your website if it uses CPanel or something similar. CPanel is a very common and popular control panel for websites, and this tutorial will be using screenshots I've taken (myself) from the (interactive) demo on CPanel's website:
This tutorial will show how to add a subdomain to your website if it uses CPanel or something similar. CPanel is a very common and popular control panel for websites, and this tutorial will be using screenshots I've taken (myself) from the (interactive) demo on CPanel's website:
Subscribe to:
Posts (Atom)