0

I am using Sublime Text 3 in Windows 10. I am trying to output a simple program in an output file. Earlier it was working fine, but now it is giving some strange alphanumeric characters as output whenever I am trying to output something.

Here's my build profile:

{
"cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" , "${file_base_name}.exe<inputf.in>outputf.in"],
"shell":true,
"working_dir":"$file_path",
"selector":"source.cpp"
}

Sample input

#include <iostream>
using namespace std;
int main() {
    for (int i = 0; i < 10; i++) {
        cout << i << endl;
    }
}

Output:

300d 0a31 0d0a 320d 0a33 0d0a 340d 0a35
0d0a 360d 0a37 0d0a 380d 0a39 0d0a 
MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • If you run from a console instead, does it show the correct values? What did you change between when it was working and now when it's not working? – Some programmer dude May 30 '21 at 12:30
  • Yes, I tried running from a console and its running fine there. And as far as I remember I haven't changed anything just there was an update of sublime text about 2-3 days ago, but after the update as well the programs were running fine but now the outputs are showing like this – Reckon Mazumdar May 30 '21 at 12:39
  • The output you show is what I'd expect to see if the output of your program was piped into something like `od -A n -x` (unlikely on `Windows` though). Is it possible the updated `sublime text` has added a similar output filter? – G.M. May 30 '21 at 12:50
  • I am not aware of that. Is there any way to fix this issue? – Reckon Mazumdar May 30 '21 at 13:04
  • It works for me just fine in ST4, once I had created `inputf.in` in the working directory. Have you tried the usual - restarting Sublime, restarting your computer? – MattDMo May 30 '21 at 16:02

3 Answers3

1

It happened with me also; I use C++14 in sublime text 3.

I would suggest to delete your sublime build file and create the same again, and your "inputf.in" and "outputf.in" files should be present in the same folder.

There's a common confusion, as we copy the sublime build file from somewhere and there may be different file names for input and output files, so match them with yours, otherwise you'll get an error - "system can't find file specified".

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Ajeet_1606
  • 11
  • 2
0

Same problem i was also facing,after the update. After that i uninstalled the setup and located the folder some where else so that after reinstallation it makes new folder for its packages and all after that i created new inputf.in and outputf.in files for competitive programming and i again used system built file as usual what i used to do and it worked....now it gives proper outputs...

0

You can do one thing

  1. First delete inputf.in, outputf.in and outputf.out files
  2. Now create new inputf.in and outputf.in file in the same folder where you are saving the cpp file

Now try to run the build. It worked for me!