fstream Tutorial

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 140
Reputation: anastacia is an unknown quantity at this point 
Solved Threads: 1
anastacia's Avatar
anastacia anastacia is offline Offline
Junior Poster

Re: fstream Tutorial

 
0
  #21
Dec 4th, 2004
well thanlks to N3wbi3C0d3r i am glad to knoiw that thete are others like me on this web. keep it up. :lol:
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: fstream Tutorial

 
0
  #22
Dec 4th, 2004
if you output abc123 to a
text file you will see abc123 but in a binary file you may see only a bunch of black
blocks if you use notepad
are you confusing this with acutally writing hex ab c1 and 23 in binary? that will give strange chars. how would you do this in the code? as said before this quote was proved to be wrong so how can you actually write 0xab 0xc1 0x23 across 3 bytes???
is it just a cast?
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: fstream Tutorial

 
0
  #23
Dec 4th, 2004
am doing it without any funds and using a free web tutorial worth crap
i no how u feel!!! i am self taught, learned by copying code from the help file in QBasic and lookin @ how it worked! having said that i am at a better standard in c++ vb and asm lang than other people i know doing A-levels in the specified subject so hold out as there are some good tuts out there. I have managed to create a few games and even worked as a software developer designing drivers and GUIs in vb just using tutorials and practising a LOT. good job too as part of my engineering masters degree is computer programming and they are using the same IDE as me (DevC++) btw i forgot to say last time thank you to 'FireNet' for the fstream tutorial. Ive been looking for a good one for a while. is there any advantage into using the Win32 API (FILE) file handling? the win32 help is a bit patchy on the subject.....
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 67
Reputation: N3wbi3C0d3r is an unknown quantity at this point 
Solved Threads: 0
N3wbi3C0d3r's Avatar
N3wbi3C0d3r N3wbi3C0d3r is offline Offline
Junior Poster in Training

Re: fstream Tutorial

 
0
  #24
Dec 5th, 2004
HeHe, im still running into some toruble learning, casue the tutorial doesnt assign home work, and im bad at creating homework on stuff i dun now, so i have to ask one of my 3 freinds who are Programming Wizards, and occasionaly here. I might soon just give up trying to do it by the internet and use a book ;p Altho i dun have the money, ill save up!
I beleive in Technology is the future, and thats were I want to be.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 140
Reputation: anastacia is an unknown quantity at this point 
Solved Threads: 1
anastacia's Avatar
anastacia anastacia is offline Offline
Junior Poster

Re: fstream Tutorial

 
0
  #25
Dec 6th, 2004
this one was more intersting. keep it up. looking forward for the next part
:lol: I am not one of those who wait for things to happen, :p but one of those who make things happen ;)
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 256
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: fstream Tutorial

 
0
  #26
Dec 9th, 2004
Originally Posted by 1o0oBhP
i no how u feel!!! i am self taught, learned by copying code from the help file in QBasic and lookin @ how it worked! having said that i am at a better standard in c++ vb and asm lang than other people i know doing A-levels in the specified subject so hold out as there are some good tuts out there. I have managed to create a few games and even worked as a software developer designing drivers and GUIs in vb just using tutorials and practising a LOT. good job too as part of my engineering masters degree is computer programming and they are using the same IDE as me (DevC++)

btw i forgot to say last time thank you to 'FireNet' for the fstream tutorial. Ive been looking for a good one for a while. is there any advantage into using the Win32 API (FILE) file handling? the win32 help is a bit patchy on the subject.....
You are welcome.

Advantages of Win32 API (FILE) file handling, are you kidding,it sucks.... well almost.One of the major problem with it is that it is platform dependent and uses C style functions.

Try this link,http://msdn.microsoft.com/library/de...ling_tasks.asp

Using standard library functions are always better than using API stuff,unless you are doning something really specific, since std library code is cross-platform and will work on any OS which has the compiler.

Originally Posted by anastacia
this one was more intersting. keep it up. looking forward for the next part
Huh well there is no next part as of such, ,it's just that darn message lying at the top.I can remove it since,we cant edit or posts after half an hour.

But Just wait till I get my site up properly...
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: fstream Tutorial

 
0
  #27
Dec 13th, 2004
What about file compression techniques like RLE? i know a bit but if you can do a tut and some code on that im sure we'd all appreciate it...
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1
Reputation: marcamillion is an unknown quantity at this point 
Solved Threads: 0
marcamillion marcamillion is offline Offline
Newbie Poster

Re: fstream Tutorial

 
0
  #28
Dec 15th, 2004
FireNet, this really is a good tutorial.

Here is my problem. I want to read in a file, the file might have x amount of lines, but on each line I would like to read in each substring, which is separated by spaces, and manipulate each.

For example. I would like to read a line which has "A2 3 G4 H5 L4" where A2 is the name of the node, so that needs to be stored in my structure as char type in variable NodeName, plus the number after the initial NodeName, 3 in this case, is the amount of nodes following it, so my program should know how many more nodes to check for. Also, a node can be named A2b or G4h or something, it stops reading the node name when it comes on a space. What is the easiest to go about doing this ?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: fstream Tutorial

 
0
  #29
Dec 15th, 2004
Have a line at the beginning specifying the number of lines. another alternative is to get the total filesize and divide it by the size of a line... You can then get lines by reading characters and stopping at "\n" chars. There also is a standard c function getline but i dont know how to use it

As for the sub strings if you have the line in a character string:

  1. char *line;
  2. char x;
  3. int i = 0;
  4.  
  5.  
  6. do
  7. {
  8. x = line[i];
  9. if(x == ' ')
  10. {
  11. // you have hit a space, the characters before are a substring
  12. }
  13. i++; // scan across the line
  14. } while (x != "\n"); // dont overrun the line

im sure it would be easier with a lot more thought, @ the moment its all i can think of. If you add another variable to track where you found the last space you can 'map out' where there are words in a string and also copy them across into another array of sub strings...

post what code you have so far including the structs and the fstream code and one of us should be able to help
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 4
Reputation: johnnyrico is an unknown quantity at this point 
Solved Threads: 0
johnnyrico johnnyrico is offline Offline
Newbie Poster

Re: fstream Tutorial

 
0
  #30
Jan 5th, 2005
Hey, Thx for the tutorial, but i was wondering how to search for text, not records.

Ex, i want to find all the records that have the word The in them how to do that?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC