Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-19-2004, 06:52 AM   #1
Beta Member
 
taicoown's Avatar
 
Join Date: Jul 2004
Posts: 2
Default whot the hell is wrong with this script (C++)!?!?!?!

Whot is wrong with this script in C++? The error in the compiler is:
error befor '['


The code:


#include <stdio.h>

#include <dos.h>

#include <dir.h>

#include <iostream>

#include <fstream.h>

#include <stdlib.h>

void main(void)

{

char drive [_MAX_DRIVE];

char directory [_MAX_DIR];

char fname [_MAX_FNAME];

char extn [_MAX_EXT];

ofstream outputFile;

const char [100000]

outputFile.open << drive << "//hello.bat" endl;

outputFile << "PAUSE" << endl;

outputFile.close();

return 0;

}





test
__________________

taicoown is offline   Reply With Quote
Old 07-19-2004, 07:20 AM   #2
In Runtime
 
0x54's Avatar
 
Join Date: Jul 2004
Posts: 157
Default

main should return a int shouldnt it?

"void main" would be better off being "int main" me thinks.
__________________

0x54 is offline   Reply With Quote
Old 07-28-2004, 10:41 PM   #3
Beta Member
 
nickbird's Avatar
 
Join Date: Jul 2004
Posts: 2
Default

first problem:
void main(void) should be:
int main()
next problem:
const char[100000]; //<--; was missing
^--you also might need a variable there...
ie
const char buffer[100000];
yes thats it if it says error before '['
that means ur missing a variable

-nickbird
nickbird is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 09:50 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0