473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to move pointer to end of the file

I want do program to search a word in the Input file if it is not found then print it to output file.
But the problem is When it search the word in first line of input file and if it is not there then it prints that word to the output file then goes to next line and again search for that word,if it is not there then again it prints it.

I want it to search the total file for that word if it finds it then nothing to do but if it finds then print it to ooutput file.

need a help .....

mahesh.....
Jan 29 '08 #1
2 1759
zippo
1
Expand|Select|Wrap|Line Numbers
  1. open(myfile, "input.txt") or die "couldnt open\n";
  2. open(output, ">output.txt") or die "couldnt open\n";
  3. $file = <myfile>;
  4. local $/=undef;
  5. if($file =~ m/pattern/){
  6. print output $word;
  7.  
  8. }
  9. close(output);
  10. close(myfile);
  11.  
check if this works :)
Feb 13 '08 #2
KevinADC
4,059 Expert 2GB
But the problem is When it search the word in first line of input file and if it is not there then it prints that word to the output file then goes to next line and again search for that word,if it is not there then again it prints it.

I want it to search the total file for that word if it finds it then nothing to do but if it finds then print it to ooutput file.

need a help .....

mahesh.....
If you need help with your code you have to post your code. We can not help with code we can not see. If you just wanted someone to write the code for you, well someone did that already, maybe it even works.
Feb 13 '08 #3

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

Similar topics

4
by: Arif | last post by:
My programs searches the header of input barcode in index file. Get the record position next to Barcode header. Then moves the file pointer of products file to reach that record. My products...
1
by: Stefan Mueller | last post by:
With the following code I can change the mouse pointer. However, if you click in Mozilla (with IE it works perfect) on 'Show hourglass' the mouse pointer changes only if you move the mouse at least...
35
by: Frederick Gotham | last post by:
(Before I begin, please don't suggest to me to use "std::vector" rather than actual arrays.) I understand that an object can have resources (e.g. dynamically allocated memory), and so we have to...
1
by: kkizer | last post by:
I have a problem with this simple code below. Moving the files works perfectly, but once in a blue moon the file that it is trying to move dissapears before it can move it. and when this happens...
3
by: Arpan | last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls. Using the FileUpload control, I want to give users the provision to move & delete files that DO NOT exist in C:\Inetpub\wwwroot...
1
by: Simon | last post by:
Dear reader, How can I move the record pointer in a sub form. The sub form is a datasheet type. Both forms have the same reference key. How can I move the record pointer in the sub form...
11
by: Robert Dufour | last post by:
As a simple example starting with a memory pointer location I need to do 10 operations, (like copying 10 values to an array for instance), then when that's done, move the pointer to the eleventh...
1
by: guptashiitd | last post by:
i want to move the pointer to some lines forward or backward in the fstream file from which i am reading the input
5
by: jslee99a | last post by:
hello I use visual basic 6.0. I want to read file twice. First i read file then i don't know how to move the file pointer to the start point. i don't want to close file and reopen. ...
12
by: karthigeyantp | last post by:
hi, i have a problem in resetting and unable to move the pointer in the text file using seekg()function in c++. what to do ??
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.