05-10-2008
10 More Discussions You Might Find Interesting
1. Programming
I have a problem that I want to insert and delete some chars in the middle of a file. fopen() and fdopen() just allow to append at the end.
Is there any simple method or existing library that allow these actions? Thanks in advance.:confused: (7 Replies)
Discussion started by: ivancheung
7 Replies
2. Shell Programming and Scripting
how do u insert text into a specific place in a file, say the middle for example, without changing the name for that file (1 Reply)
Discussion started by: mopimp
1 Replies
3. Shell Programming and Scripting
Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.
Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the... (3 Replies)
Discussion started by: ali hussain
3 Replies
4. Shell Programming and Scripting
I wrote a script like
#!/bin/bash
echo $1 > temp
cat $2 >> temp
mv temp $2
now I have problem appending the above script(only using bash shell) so that it now inserts the first argument into the middle of the file.
I have tried using $(('wc -l < file' / 2 ))
but invain so could any one... (4 Replies)
Discussion started by: boris
4 Replies
5. Shell Programming and Scripting
how to insert one file into another file not by concatenating as usual done.
file1
A B
C D
E F
G H
I J
K L
file2
23455
33444
33334
33345
Output shud be
23455
A B
C D (4 Replies)
Discussion started by: cdfd123
4 Replies
6. Shell Programming and Scripting
I want to insert a text into the middle of a file (3 Replies)
Discussion started by: relle
3 Replies
7. Shell Programming and Scripting
Can anyone help me pls? I want to add a text into the middle of file.
I've writtenthe following script
text to add="$1"
file="$2"
lines=$(wc -l $2)
half_lines=$(expr $lines / 2)
head -$half_lines $2 > temp
echo "text to add" >> temp
((half_lines=$half_lines + 1))
tail -$half_lines $2... (6 Replies)
Discussion started by: relle
6 Replies
8. Shell Programming and Scripting
I have tried
sed '/6/a text_to_inserted' file > newfile
but this inserts test_to_insert at random places in file and i want it in specific location, which is line 6.
can anyone help.... (6 Replies)
Discussion started by: phenom
6 Replies
9. Shell Programming and Scripting
Hi I am trying to write a bash script to add a line of text to the middle of a file.
The way I worked it out was to calculate the number of lines and divide by 2. The file I am using is called newfile and it just contains lines of data.
The new file I have created I have called midfile and... (7 Replies)
Discussion started by: BundBash
7 Replies
10. Shell Programming and Scripting
Hi,
So far i've made a script that takes two argument, 1st is the contents and the 2nd is the named file. At the moment i've managed to insert new contents as a new line at the top, but i want to ask how can you insert contents in the middle of the file?
Source Code
#!/bin/bash
#Write... (3 Replies)
Discussion started by: zen10
3 Replies
LEARN ABOUT PHP
get_camera_matrix
get_camera_matrix(3alleg4) Allegro manual get_camera_matrix(3alleg4)
NAME
get_camera_matrix - Constructs a camera matrix for perspective projection. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
void get_camera_matrix(MATRIX *m, fixed x, y, z, xfront, yfront, zfront, fixed xup, yup, zup, fov, aspect);
DESCRIPTION
Constructs a camera matrix for translating world-space objects into a normalised view space, ready for the perspective projection. The x,
y, and z parameters specify the camera position, xfront, yfront, and zfront are the 'in front' vector specifying which way the camera is
facing (this can be any length: normalisation is not required), and xup, yup, and zup are the 'up' direction vector.
The fov parameter specifies the field of view (ie. width of the camera focus) in binary, 256 degrees to the circle format. For typical pro-
jections, a field of view in the region 32-48 will work well. 64 (90(de) applies no extra scaling - so something which is one unit away
from the viewer will be directly scaled to the viewport. A bigger FOV moves you closer to the viewing plane, so more objects will appear. A
smaller FOV moves you away from the viewing plane, which means you see a smaller part of the world.
Finally, the aspect ratio is used to scale the Y dimensions of the image relative to the X axis, so you can use it to adjust the propor-
tions of the output image (set it to 1 for no scaling - but keep in mind that the projection also performs scaling according to the view-
port size). Typically, you will pass (float)w/(float)h, where w and h are the parameters you passed to set_projection_viewport.
Note that versions prior to 4.1.0 multiplied this aspect ratio by 4/3.
SEE ALSO
apply_matrix(3alleg4), get_align_matrix(3alleg4), set_projection_viewport(3alleg4), persp_project(3alleg4)
Allegro version 4.4.2 get_camera_matrix(3alleg4)