Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9173227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:32:25+00:00 2026-06-17T16:32:25+00:00

I am using Dev C++ to write to a text file using ofstream but

  • 0

I am using Dev C++ to write to a text file using ofstream but it does not work, I have made a text file in dev c++and saved it and on another source file I wrote the following code:

  #include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;

int main(){

srand(time(0));
ofstream out(“hello.txt”);

for(int i=0;i<100;i++)
          out << rand()%1000 << “ “;
out.close();


return 0;
}

However, when I try to compile this code I get an error and it highlights the following in red:

ofstream out(“hello.txt”);

It says hello undeclared.

The tutorials that I am following are from youtube and the programmer is using a Linux operating system, he is using g++, will the code still be the same on all operating systems? because I am using windows 7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:32:27+00:00Added an answer on June 17, 2026 at 4:32 pm

    However, when I try to compile this code I get an error and it highlights the following in red:

    Your quotes are “smart quotes”. See how they’re all bendy (“”), instead of straight ("")?

    Use normal, straight quotation marks.

    Do not program in Word. You may also have to change a Windows setting as I vaguely recall that some keyboard drivers have a smart quotes mode (which boggles the mind).


    The tutorials that I am following are from youtube and the programmer is using a Linux operating system, he is using g++, will the code still be the same on all operating systems? because I am using windows 7

    For standard code like this yes, absolutely, by design.

    When you start playing with OS-specific functionality (i.e. anything from POSIX or the Windows API) then it gets more complex, but you’re not there yet.

    And I can’t recommend enough that you put down your “tutorials” and get a real C++ book.

    (It may even be that the smart quotes came from the tutorial website itself! If so, you should inform the author immediately.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Dev C++ to write a simple C program and I need to
I'm using propel master-dev with symfony 2.1. Is possible to write something like that
I am using http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/portal/portal.html to build a portal. Obviously, i have custom windows inside
I have a large(20MB) text (input) file with various lines of text (including blank
I have an asp:listview using a css class. On my dev system (VS2008), it
--------- EDIT I have found the easiest was to write lines to a text
I am trying to write an audio application using PortAudio, but if any other
I am using subprocess to create a random file from /dev/random using unix dd.
I'm using HTTP::Server::Simple::CGI to write a simple webserver. Within my handler, I have to
I wrote a program in C++/OpenGL (using Dev-C++ compiler) for my calculus 2 class.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.