Sponsored Content
Full Discussion: Reading a file into an array
Top Forums UNIX for Dummies Questions & Answers Reading a file into an array Post 302336120 by vgersh99 on Tuesday 21st of July 2009 09:22:44 AM
Old 07-21-2009
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash: Reading out rows of a file into a dynamic array and check first literal

Hello, i have a file "Movie.ini" looking e.g. like follows * MOVIE A bla bla MOVIE B blubb blubb MOVIE C I'd like to read the file "Movie.ini" with cat and grep and check whether it includes the string MOVIE only with a '*' at the beginnig. By doing "cat Movie.ini| grep MOVIE... (14 Replies)
Discussion started by: ABE2202
14 Replies

2. Shell Programming and Scripting

Reading from array

Hi, I have an array like below... Table="table1" Table="table2" Table="table3" Table="table4" ..... Table="tablen" I want to retireve the values from the array and need to pass this to a db2 command to create a view like below. the number of values in the array will vary ... (1 Reply)
Discussion started by: ratheeshjulk
1 Replies

3. Programming

Reading Scientific notation from file and storing in array

Hi, I am trying to read a set of numbers that are in scientific notation into a file so I can do some math on them, but when I display the array contents the numbers aren't the same as the numbers in the file. Could someone explain why? Thanks. int main() { double fArray; ... (3 Replies)
Discussion started by: Filter500
3 Replies

4. Shell Programming and Scripting

Reading from a file and assigning to an array in perl

I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value. I was thinking the best way to... (1 Reply)
Discussion started by: billprice13
1 Replies

5. Shell Programming and Scripting

reading data from a file to an array

I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array? while read line; do read -A array <<<$line n=${#array} for ((i=1;i<$n;i++)); do print... (1 Reply)
Discussion started by: gavin_L
1 Replies

6. Shell Programming and Scripting

Help with reading column in array

I have some version problem to use this code in my server while read line; do read -A array <<<$line <---------- the server dont read <<< n=${#array} for ((i=1;i<$n;i++)); do print "${array}" done func=${array} data1=${array} data2=${array} ... (1 Reply)
Discussion started by: gavin_L
1 Replies

7. Shell Programming and Scripting

Reading columns from a text file and to make an array for each column

Hi, I am not so familiar with bash scripting and would appreciate your help here. I have a text file 'input.txt' like this: 2 3 4 5 6 7 8 9 10 I want to store each column in an array like this a ={2 5 8}, b={3 6 9}, c={4 7 10} so that i can access any element, e.g b=6 for the later use. (1 Reply)
Discussion started by: Asif Siddique
1 Replies

8. Shell Programming and Scripting

Reading a file into array

Hi, I need to read a file into array and print them in a loop:- 1st file :-cat a.txt RC1 RC2 RC3 RC4 My Program:- #!/bin/ksh index=0 while do read cnt<a.txt print "cnt value is ${cnt} index=`expr $index + 1` done Code tags for code, please. (5 Replies)
Discussion started by: satishmallidi
5 Replies

9. Shell Programming and Scripting

Reading a file into an array

Hi I have a file with contents as below : server | ABC Issue : File System Missing XYZ Issue : Wrong Syntax PQR Issue : Old File to be removed Now I am looking for an o/p similar to server <tab> ABC Issue : File System Missing <tab> XYZ Issue : Wrong Syntax <tab>... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

10. Shell Programming and Scripting

Help reading the array and sum of the array elements

Hi All, need help with reading the array and sum of the array elements. given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large. Input Format The first line of the input consists of an... (1 Reply)
Discussion started by: nishantrefound
1 Replies
load_bitmap_font(3alleg4)					  Allegro manual					 load_bitmap_font(3alleg4)

NAME
load_bitmap_font - Grabs a font from a bitmap file. Allegro game programming library. SYNOPSIS
#include <allegro.h> FONT *load_bitmap_font(const char *filename, RGB *pal, void *param) DESCRIPTION
Tries to grab a font from a bitmap. The bitmap can be in any format that load_bitmap understands. The size of each character is determined by the layout of the image, which should be a rectangular grid containing all the ASCII characters from space(32) up to the tilde(126). The way the characters are separated depends on the color depth of the image file: paletted (8 bit) image file Use color 0 for the transparent portions of the characters and fill the spaces between each letter with color 255. High (15/16 bit) and true (24/32 bit) color image file Use bright pink (maximum red and blue, zero green) for the transparent portions of the characters and fill the spaces between each letter with bright yellow (maximum red and green, zero blue). Note that in each horizontal row the bounding boxes around the characters should align and have the same height. Probably the easiest way to get to grips with how this works is to load up the `demo.dat' file and export the TITLE_FONT into a PCX file. Have a look at the resulting picture in your paint program: that is the format a font should be in. Take care with high and true color fonts: Allegro will convert these to the current color depth when you load the font. If you try to use a font on a bitmap with a different color depth Allegro will do color conversions on the fly, which will be rather slow. For optimal perfor- mance you should set the color depth to the color depth you want to use before loading any fonts. RETURN VALUE
Returns a pointer to the font or NULL on error. Remember that you are responsible for destroying the font when you are finished with it to avoid memory leaks. SEE ALSO
register_font_file_type(3alleg4), load_font(3alleg4), load_bitmap(3alleg4), set_color_depth(3alleg4), grab_font_from_bitmap(3alleg4) Allegro version 4.4.2 load_bitmap_font(3alleg4)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy