Bug 480540 - redirect input console/file
Summary: redirect input console/file
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Windows 10
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-23 15:49 EDT by federico bianchi CLA
Modified: 2015-11-25 00:02 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description federico bianchi CLA 2015-10-23 15:49:33 EDT
I'm trying to use the option to redirect the standard inout from a file but the code wait for a input from the console...
How does this feature work?


-- Configuration Details --
Product: Eclipse 4.5.1.20150917-1200 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.platform 4.5.1.v20150904-0015
Comment 1 Sarika Sinha CLA 2015-10-24 08:47:31 EDT
Have you used the options in "Common" tab of Run/Debug Configurations Dialog ?
Comment 2 federico bianchi CLA 2015-10-26 12:54:31 EDT
Sure!
from the console, no problem to get the input.
When I flag the option to use the file and navigate through the file system (not the workspace button because i know there a problem with format of the string in
the file name textbox) the software runs but wait for an input and if i enter it in the console it accept the input and the code proceed with the next instruction. If I uncheck the console checkbox it waits forever...

(In reply to Sarika Sinha from comment #1)
> Have you used the options in "Common" tab of Run/Debug Configurations Dialog
> ?
Comment 3 Sarika Sinha CLA 2015-10-27 06:54:53 EDT
(In reply to federico bianchi from comment #2)
If I uncheck the console checkbox it waits forever...



Yes , If we uncheck the console checkbox, we cannot provide an input from console.

I think we can close this as Works as expected ?
Comment 4 federico bianchi CLA 2015-10-27 10:05:27 EDT
(In reply to Sarika Sinha from comment #3)
> (In reply to federico bianchi from comment #2)
> If I uncheck the console checkbox it waits forever...
> 
> 
> 
> Yes , If we uncheck the console checkbox, we cannot provide an input from
> console.
> 
> I think we can close this as Works as expected ?

what if i want the input from a file?
Comment 5 Sarika Sinha CLA 2015-11-02 03:09:56 EST
For that We have a separate check box, Input File.
Comment 6 federico bianchi CLA 2015-11-04 17:25:00 EST
Ok. Go back and Read my secondo message above...

(In reply to Sarika Sinha from comment #5)
> For that We have a separate check box, Input File.
Comment 7 Sarika Sinha CLA 2015-11-04 23:33:02 EST
Can you please attach a sample program and input file, with which you are facing problem ?
Comment 8 federico bianchi CLA 2015-11-18 10:56:02 EST
(In reply to Sarika Sinha from comment #7)
> Can you please attach a sample program and input file, with which you are
> facing problem ?

Sorry for the late answer, I was away.
Here the code I'm using:

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

int main(int argc, char *argv[]){
  if(argc != 2) {
      cout << "Usage: " << endl;
      cout << " mergesort" << endl;
      cout << " legge da stdin i valori numerici (int) da ordinare (max 10^4), uno per riga" << endl;
      cout << " produce in output la sequenza ordinata" << endl;
      exit(1);
  }
  const int MAX_SIZE = 10000;
  int array[MAX_SIZE];
  int size = 0;
  while((size < MAX_SIZE) && (cin >> array[size++])) ;
  if(cin.eof()) size--;

  for(int i = 0; i < 7; i++) {
    cout << array[i] << endl;
  }

  return 0;
}

then I have a file "array.txt" with just some number in it.
Comment 9 Sarika Sinha CLA 2015-11-25 00:02:44 EST
Hi Federico,
Thanks for the patience.
 
So if there is no console, we should redirect it to a output file if we want to see the output. As there is no console assigned, you can't see the output there.
Let me know if it helps.