|
-
Aug 29th, 2001, 04:03 AM
#1
little program, help needed
I need a small program, and I'm stuck.
The program should read in an entire file and remove everything between two control phrases (including the control phrases). It should then write the result to a new file.
The control phrases are:
//!!COMMENT marks the start
ENDCOMMENT!!// marks the end
Th program should be a console app called like this:
program srcfile dstfile
Is there anything available or has anybody got tips for me?
How do you get the file length? How do you edit the puffer?
Thx in advance
All the buzzt
CornedBee
-
Aug 29th, 2001, 04:42 AM
#2
transcendental analytic
Have a look at the Stream I/O routines on msdn site
http://msdn.microsoft.com/library/de...eam_i.2f.o.asp
or if you want the more speedy variant, File I/O Reference
http://msdn.microsoft.com/library/de...lesio_4lf7.asp
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 29th, 2001, 05:02 AM
#3
I have a local msdn version, but I can't find the functions to get the file length. And the documentations of the STL and stream classes sucks. I can't find anything there.
Maybe you have function names that I can look up? Or should I switch to API calls?
All the buzzt
CornedBee
-
Aug 29th, 2001, 06:12 AM
#4
Frenzied Member
To get the file length, first open the file using fopen(). Then use
Code:
fseek(Pointer to FILE structure,0,SEEK_END);
long filelength = ftell(Pointer to FILE structure);
-
Aug 29th, 2001, 06:53 AM
#5
Thanks, it's useless anyway because the file format sucks (it's not plain text), so I can't do what I wanted.
I'll know next time, so thanks anyway.
All the buzzt
CornedBee
-
Aug 29th, 2001, 07:05 AM
#6
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|