![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
input output streaming
I edited and used following code from an internet source. im having trouble with the commented line (TBitstream=fgetc(fp)
. aparently fgetc is used for integers. what should i type instead to cin.getline(Tbitstream).. cout<<"Enter Filename To Input Bitstream From: "; char * filename = new char [100]; FILE *fp; gets(filename); if((fp=fopen(filename,"rb"))==NULL) { cout<<"FILE DOES NOT EXIST"<<endl; exit(1); } char * TBitstream = new char [2000]; //TBitstream=fgetc(fp); fclose(fp); |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
forgot to say thanks
![]() |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Try reading your docs. Makes a helluva difference. fgetc returns an integer representing a character or status. Since you're programming C++, you might want to explore C++ mechanisms, also.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 894
Rep Power: 4
![]() |
If you want to read a line, use fgets. If you want to read some binary data, use fread.
|
|
|
|
|
|
#5 | ||
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
Quote:
Quote:
|
||
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|