473,385 Members | 1,829 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,385 software developers and data experts.

Changing Text in Files

vninja
40
Hi, i'm totally lost.

Im trying to create a program that reads a file and then changes some text in the file. i've got a couple approaches to this problem but i cannot find the resources nessesary for me to complete any of these. if anyone could help i'd greatly appriciate it.

So these are the challenges:
I:
Read from text file
search for specific words
replace (delete then add, etc.)
close file
send file to printer.

II:
open file
write the text to file including printer escape codes to bold and change txt
size and maybe txt font
close file
send file to printer

III:
open to suggestions on other approaches to this problem.

I found out how to open, close, write to, and print file but i cannoth find how to replace words.
the codes that i am finding on how to seek for txt i don't quite understand. if anyone could send an example i'd appriciate the help

Thx
V
Oct 9 '06 #1
4 2310
vninja
40
Ok i figured out one part (which i can't believe my idioticy) for the text formatting. a simple approach of using html instead of txt file and using the html tags to format the txt for me. but now i need to know how to print the file ny1 any suggestions?
Oct 12 '06 #2
Banfa
9,065 Expert Mod 8TB
The problem in part II is that as stated you would need to know what the printer was as not all printers talk the same language.
Oct 12 '06 #3
vninja
40
Thanks that just totally sux. but isn't that why there are drivers to convert from comp lang to print lang? just wondering. i realized that its on a network under a static i.p. and its some kind of HP laser if thats not too vague
Oct 12 '06 #4
Banfa
9,065 Expert Mod 8TB
Oh there is (in Windows anyway but I would assume Linux has a way as well).

You create a printer DC (device context) and draw to that device context, then windows , the HAL and the printer driver sort out the actual printing.

It is however quite involved.

So you can just send the file to the printer you have to draw data on the printer device context.

Alternitively if the file is a text file or some other file with a recognised extension you can cheat and have Notepad do it for you by

ShellExecute(NULL, "print", <FileName>, NULL, NULL, 0);
Oct 12 '06 #5

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

Similar topics

7
by: kah | last post by:
How do I change a line in a file?? For example I have the follwing text in my file: line1 line2 line3 line4 How do I replace 'line2' with 'newline'. Since the write operation in
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
1
by: Wayne | last post by:
I'm using the following code from the Access Web to open a folder. The folder opens in "List" View. Is there an addition that I can make to the code to force the folder to open in "Details" view?...
5
by: Mark Fox | last post by:
Hello, When you add a new web form in VS.NET it automatically adds the following namespaces at the top: using System; using System.Collections; using System.ComponentModel; using...
0
by: Rahul | last post by:
I have some resx files inside my Global Resources folder for the web and some other Resx files for the DataAccess layer project .For web project I am using Resx files for the Form control's...
7
by: Jeffrey Spoon | last post by:
Hello, I'm a bit stuck trying to convert a text file which contains extended ASCII text and changing the ASCII values so they become readable. I do this by subtracting 127 from the ASCII value....
6
by: PipedreamerGrey | last post by:
I'm using the script below (originally from http://effbot.org, given to me here) to open all of the text files in a directory and its subdirectories and combine them into one Rich text file...
4
by: Trapulo | last post by:
I've a webservice with a string parameter. I call this webservice passing a string that is 1129 chars length. On the webservice, the received string is 1146 length (I tested sizes with...
4
by: Jay | last post by:
What's the recommended way to change file/folder names within a project? I want to change the solution name from (say) sol1.sln to sol2.sln, and also everything else named sol1.* (eg sol1.suo,...
4
by: tshad | last post by:
I have an executable that has a button that I want to change the name of to "Now Processing...". When the process is done, I want to change it back. The problem is that the form is not showing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...

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.