Skip to main content
gamedev.net
🔒 Locked

File I/O

Started by Xtremehobo Jul 19, 2003 at 1:41 PM 3 replies 300+ views
Original Post
Xtremehobo
Xtremehobo
How would I go about creating a buffer (in c++) that''s the size of a file that I open with fopen? I''ve tried: char databuffer[myfile->_bufsiz]; but I get this error: expected constant expression. I guess It has to be constant :-\ How would I go about creating a buffer the size of a file that is trying to be opened?
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
evolutional
evolutional
char *databuffer = new char[myfile->_bufsiz];
Xtremehobo
Xtremehobo
works, thanks
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
Pipo DeClown
Pipo DeClown
new delete
new new delete delete
new new new delete delete delete
so..

char *databuffer = new char[myfile->_bufsiz];
delete[] databuffer;

.lick

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.