i am currently working on an assignment that requires the program to
manage the files like editing file content, modifying file content,
and deleting file contents.
My question is what sort of header files i need to open a files, and
what sort of function i can used to input/output a file content,
another thing is that what sort of functions are they for me to know
the location of the files pointer? 4 3896
"Jerry Khoo" <je*********@yahoo.com> wrote in message
news:b6************************@posting.google.com ... i am currently working on an assignment that requires the program to manage the files like editing file content, modifying file content, and deleting file contents.
My question is what sort of header files i need to open a files, and what sort of function i can used to input/output a file content, another thing is that what sort of functions are they for me to know the location of the files pointer?
Don't you have access to a manual? Look at this site if you don't http://www.dinkumware.com/refxcpp.html
All the functions you need are in the fstream header.
john
"Jerry Khoo" <je*********@yahoo.com> wrote in message
news:b6************************@posting.google.com ... i am currently working on an assignment that requires the program to manage the files like editing file content, modifying file content, and deleting file contents.
My question is what sort of header files i need to open a files,
<fstream>
and what sort of function i can used to input/output a file content,
Input:
read(), operator>>(), get()
Output:
write(), operator<<(), put()
another thing is that what sort of functions are they for me to know the location of the files pointer?
tellg()
Where's your textbook?
-Mike
You can use old C style to open files. Here is come example of code:
#include <stdio.h>
FILE *in, *out;
char ch;
void main()
{
in=fopen("c:\test.txt", "rb");
out=fopen("c:\test-res.txt", "wb");
while (1)
{
ch=fgetc(in);
if(feof(in))break;
fputc(ch, out);
}
}
I think that you will understand everything thet i wrote.
Best regards. Vladimir Shishkovsky
"Mike Wahler" <mk******@mkwahler.net> сообщил/сообщила в новостях следующее:
news:Y1******************@newsread2.news.atl.earth link.net... "Jerry Khoo" <je*********@yahoo.com> wrote in message news:b6************************@posting.google.com ... i am currently working on an assignment that requires the program to manage the files like editing file content, modifying file content, and deleting file contents.
My question is what sort of header files i need to open a files,
<fstream>
and what sort of function i can used to input/output a file content,
Input:
read(), operator>>(), get()
Output:
write(), operator<<(), put()
another thing is that what sort of functions are they for me to know the location of the files pointer?
tellg()
Where's your textbook?
-Mike
Vladimir Shishkovsky wrote:
Don't Top-post, rearranged. "Mike Wahler" <mk******@mkwahler.net> сообщил/сообщила в новостях следующее: news:Y1******************@newsread2.news.atl.earth link.net...
"Jerry Khoo" <je*********@yahoo.com> wrote in message news:b6************************@posting.google.c om...
i am currently working on an assignment that requires the program to manage the files like editing file content, modifying file content, and deleting file contents.
My question is what sort of header files i need to open a files, <fstream>
and what sort of function i can used to input/output a file content,
Input:
read(), operator>>(), get()
Output:
write(), operator<<(), put()
another thing is that what sort of functions are they for me to know the location of the files pointer?
tellg()
Where's your textbook?
-Mike
You can use old C style to open files. Here is come example of code:
#include <stdio.h>
FILE *in, *out; char ch;
void main()
The main function returns an int. Always.
int main(void)
{ in=fopen("c:\test.txt", "rb");
The "\t" is an escape sequence for a tab. To get a backslash
character one has to use two backslashes:
in = fopen("c:\\test.txt", "rb");
Not also that one should always check if the open succeeded:
if (!in)
{
/* Handle error here */
}
out=fopen("c:\test-res.txt", "wb");
out = fopen("c:\\test-res.txt", "wb");
if (!out)
{
/* Handle error here */
} while (1) { ch=fgetc(in); if(feof(in))break; fputc(ch, out); }
return EXIT_SUCCESS; /* see <stdlib.h> or <cstdlib> */ }
A more efficient method would be to read blocks of data
at a time. The size of the block should be something large
enough to keep the file device running for a while, but
small enough to fit into the program space. I think that you will understand everything thet i wrote.
that I Best regards. Vladimir Shishkovsky
--
Thomas Matthews
C++ newsgroup welcome message: http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq: http://www.raos.demon.uk/acllc-c++/faq.html
Other sites: http://www.josuttis.com -- C++ STL Library book This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: fabien |
last post by:
Hi,
I am writing a POV-RAY editor with Python using either QT or GTK as GUI
'wrapper'. ( I am still trying both )
* * * * PYGTK * * * *
I have downloaded PygtkScintilla-1.99.5.
There is a...
|
by: joethis |
last post by:
Is there a way to make sure that a file is already in use using asp? For
instance, if one person has opened a file and is about to write to it; then
is there a way to keep another user from...
|
by: Parker.Jim |
last post by:
I need to write a program which performs word subsitutions on a text
file. The program should input the names of three text files: the
source file that will be "edited", a text file that contains...
|
by: Tom marsh |
last post by:
I'm finishing an application and want to supply help files. However MS
Access's help files, ironically don't contain much help on HELP. What is
the best approach? I could easily just provide...
|
by: JebBushell |
last post by:
"Description: An application error occurred on the server. The current custom
error settings for this application prevent the details of the application
error from being viewed remotely (for...
| |
by: Rahul |
last post by:
Hi Everybody
I have some problem in my script. please help me. This is script file.
I have one *.inq file. I want run this script in XML files. But this
script errors shows . If u want i am...
|
by: sowmram |
last post by:
Hi,
I'm trying to create a site very similar to wiki, where you can edit, save.. Generally update data for the future use... This particular program I wanna do it using javascripts...
Please...
|
by: Lawrence Krubner |
last post by:
To guard against our users possibly uploading huge files, I've got this
in my php.ini file:
; Maximum size of POST data that PHP will accept.
post_max_size = 10M
On a server running Ubuntu...
|
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...
|
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,...
|
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...
| |
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: 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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |