![]() |
|
#11
|
|||
|
|||
Re: Pointers and C ++ (use)It does not appear that you are doing any testing because the code does not compile. Once again, the statement:
Quote:
It appears that you want to write all characters into a buffer. The buffer must have a size. For compilation to succeed, the size must be known. Even though you may not know what is the longest line in the file, you have two choices:
http://www.cplusplus.com/reference/i...m/getline.html Once you understand the usage of getline(), you can use it in file I/O as: CPP / C++ / C Code:
|
|||
|
#12
|
|||
|
|||
Re: Pointers and C ++ (use)Hi, Ocicat i think i get your point ok i declared a *ch (char type) then this statement is wrong ch=new char[]; cuz *ch will be aa dynamic arry of char without a size but i think may be the express edition vc++ 2005 is taking that as ch=new char[0]; cuz i run the application and it did work and i can just use a char variable not a pointer.
now i checked your code the buffer is reading an amount of [255] the how to empty it and fill it up again where u left. |
|
#13
|
|||
|
|||
Re: Pointers and C ++ (use)Quote:
Any space that is allocated at runtime must be non-zero in size. While the following: CPP / C++ / C Code:
Quote:
Quote:
The buffer is repeatedly overwritten with the current line read from the file. Once the line is echoed to stdout, the buffer is overwritten with the next line. I gather that English is not your first language. Coupled with the fact that you are not comfortable with the concepts involved, I question the quality of the communication. I would recommend that you discuss these matters with your instructor. |
Recent GIDBlog
Match IP in CIDR by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sort an array of structures | sassy99 | C Programming Language | 10 | 15-Feb-2007 07:46 |
| [Tutorial] Function Pointers | aaroncohn | C++ Forum | 4 | 17-Feb-2006 11:33 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 17:36 |
| [Tutorial] Pointers in C (Part I) | Stack Overflow | C Programming Language | 1 | 08-Apr-2005 18:35 |
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The