0

I couldn't find any answer for my problem anywhere. I hope this is not a silly question.

I wrote a program in c on c9.io, it is working flawlessy: it compiles and runs with no problem at all.

Due to an internet mulfunction now I cannot rely on c9.io.

Anyways, I downloaded the code (the c code, not the compiled file), I compiled it on my Ubuntu VirtualBox machine and no problem, just to be a 100% sure I also made a "chmod +x" on the compiled file.

But when it comes to running the compiled file, it gives an error generated by this piece of code:

if(read(mypipe[number*2],buff,sizeof(buff)) == -1){
                perror("read 1");
            } 

This wasn't happening on c9.io, the same code (copied & pasted) on c9.io is not printing this error. I'm really stuck on this, please help me :'(

INFO: On c9.io I'm using a machine running the blank Ubuntu

EDIT: The variables appearing on the piece of code I pasted are all defined, as a matter of fact the same code is working on c9.io without ANY changes.

kefete
  • 33
  • 2
  • 9
  • `mypipe[number*2]` is not defined. (and neither is`buff`) – wildplasser Jun 25 '17 at 23:18
  • Yes, they are. The piece of code above is the one generating the error, it is not the whole code. – kefete Jun 25 '17 at 23:50
  • Show them. (otherwise the question cannot be answered) – wildplasser Jun 25 '17 at 23:53
  • I'm not sure if that would help, because the exact same code (no changes at all, not even a comment, infact it's a copy&paste from c9.io) is running without giving that error on c9.io. Anyways here is the declaration of the pipe "int mypipe[number];" and here the buff's one "char buff[100];" and here is where I create the pipe "var =pipe(&mypipe[i]);" var is declared as "int var;" – kefete Jun 26 '17 at 00:01

0 Answers0