i'w wondering whether there is a difference between fstream and stdio.h when processing a file with these data

10 10 
P

with fstream it's easier to get the data since with stdio.h i'd need to get every single char and number with getc() and translate i t into whole numbers like 10 am i right ? is there another function in stdio.h to make things a lot easier and faster ?


please if there is even a slight difference tell me

thanx in advance

> i'w wondering whether there is a difference between fstream and stdio.h
One is C++, the other is C

> i'd need to get every single char and number with getc() and translate i t into whole numbers like 10 am i right ?
It's one way, not the only way.

> is there another function in stdio.h to make things a lot easier and faster ?
fscanf - easy to get going, but hard to make secure.
fgets + strtod / strrol / strtoul - a bit more work, but very safe.

can anyone give me a simple example of what Salem hsa mentioned for example with fscanf

thanx

It should be noted that short of speed, you really need to consider how safe fprintf is. Just remember that read chuncks of data at a time is somewhat faster than reading 1 bye at a time

Chris

This question has already been answered. Start a new discussion instead.