Am i doing something wrong?

The file im creating keepsgetting truncated and I dunno why..

1
2
3
4
5
6
7
8
9
10
11
12
  /* Im using Turbo c++ cause Im a student*/

#include <iostream.h>
#include <fstream.h>

int main (){

ofstream fileCreate;
fileCreate.open("c:\\Averyveryverylongfilename.txt");
fileCreate.close()
}
/*The filename would only be 9 characters long.. I dunno why..*/
1. I rely recommend using a better IDE
turbo c/c++ is good for ms-dos applications
but otherwise try
this web-page I found to get started
http://www.tricksmode.com/2013/02/top-10-best-c-compilers.html
2.
what do you mean by truncated ive never heard that word before.
3.
i think in turbo c++ you have to return 0
1
2
3
4
5
6
7
8
9
10
11
12
 /* Im using Turbo c++ cause Im a student*/

#include <iostream.h>
#include <fstream.h>

int main (){

ofstream fileCreate;
fileCreate.open("c:\\Averyveryverylongfilename.txt");
fileCreate.close()
return 0;//add this i dont know if it will fix your problem though
}
Last edited on
/*The filename would only be 9 characters long.. I dunno why..*/

Because Turbo C++ was written for DOS. That's not Windows 95, not Windows 3.1, DOS. It's that old.

If you really are a student and are serious about learning C++ the best thing you can do is to use an up-to-date compiler. Not something from ... well antiquity.



@tomplusplus
http://www.techterms.com/definition/truncate
Last edited on
If I did that my project would not be accepted since my designated compiler is turbo c++.

Also when I say truncated.. It meant that it would only show a part of the filename i wrote

If i were to say that I wrote "ListOfRooms.txt" for a text file, the program would only create a text file with the name "ListOfRoo.txt" is this normal?
It would be normal for DOS to use file names such as "LISTOFRO.TXT".
http://en.wikipedia.org/wiki/8.3_filename

I understand the difficulties you face as a student when your course requires you to use a particular compiler. However, at the very least you should be aware that in the outside world, for example if you look for a job in the future, you will encounter much more recent versions of C++ .
In my perspective I look at Turbo C++ as a stepping stone and I am aware of the differences between turbo c++ and the modern compilers. Also thank you for your concern, Im really interested in learning c++ because of the possibilities it brings to the table. I hope I learn more as I become aware of new techniques and tricks :)
Last edited on
Topic archived. No new replies allowed.