473,508 Members | 4,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading .txt file in array format

2 New Member
how to store data of .txt file into array. means one line it treats as a one element of array. next line is next elment and so on..
Nov 29 '07 #1
3 2210
numberwhun
3,509 Recognized Expert Moderator Specialist
how to store data of .txt file into array. means one line it treats as a one element of array. next line is next elment and so on..
This is a pretty basic question and I think you need to go and read something like Beginning Perl.

I am not saying that we are above these questions, because we are not, but you learn by reading and doing and that is something that is pretty easy.

Regards,

Jeff
Nov 29 '07 #2
KevinADC
4,059 Recognized Expert Specialist
I agree with Jeff, read the link he posted. Next time pleasae show some effort to solve your questions:

Expand|Select|Wrap|Line Numbers
  1. open (FH, 'filename') or die "$!";
  2. my @array = <FH>;
  3. close FH;
  4. print "$_" for @array;
Nov 29 '07 #3
numberwhun
3,509 Recognized Expert Moderator Specialist
I agree with Jeff, read the link he posted. Next time pleasae show some effort to solve your questions:

Expand|Select|Wrap|Line Numbers
  1. open (FH, 'filename') or die "$!";
  2. my @array = <FH>;
  3. close FH;
  4. print "$_" for @array;
Same user, two different questions, same link to the same book given. Gotta love it.
Nov 29 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4066
by: Cormac O'Donnell | last post by:
I am implementing an fft algorithm in java and would like to clear this point up. I am reading a 16 bit wav file with format : float sampleRate = 16000; //8000,11025,16000,22050,44100 int...
2
2012
by: Albert Tu | last post by:
Hi, I am learning and pretty new to Python and I hope your guys can give me a quick start. I have an about 1G-byte binary file from a flat panel x-ray detector; I know at the beggining there...
2
3054
by: Jeevan | last post by:
Hi, I have an array of data (which I am getting from a socket connection). I am working on a program which acts on this data but the program is written to work on data from a file (not from an...
7
6033
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
29
10373
by: yourmycaffiene | last post by:
Okay, this if my first post so go easy on me plus I've only been using C for a couple of weeks. I'm working on a program currently that requires me to read data from a .dat file into a 2d array and...
6
5243
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
7
11767
by: ianenis.tiryaki | last post by:
well i got this assignment which i dont even have a clue what i am supposed to do. it is about reading me data from the file and load them into a parallel array here is the question: Step (1) ...
0
2174
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
13
3573
by: rsk | last post by:
Hi Friends, My requirement is as follows; A file is consisting of data in hexadecimal format(i.e a 32 bit data for example like "0xdeadbeef"). I have to read each of such data into my 'c'...
1
2902
by: stevedub | last post by:
I am having some trouble configuring my array to read from a sequential file, and then calling on that to fill an array of interests. I think I have the class set up to read the file, but when I run...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.