Skip to content

Tag: c++

Strange Output Difference Between GCC and MinGW (C++)

I’m working on a project for a computer science class. I wrote the code and tested it using MinGW, and it works fine. I then copied the code over to the university’s Linux server and tested it there, since that’s what my professor grades assignments on. The output is very different – l…

Installing PHP in my home directory

I need to install PHP in my home directory, without polluting any directory outside my home [very important requirement!]. In the system there is already an older version of PHP running. I found instructions here: http://blog.thecybershadow.net/2013/01/25/installing-php-and-apache-module-under-home/ I am runn…

How to execute a sudo command with in a C/C++ Program?

I would like to execute one of my sudo commands through one of my C demon. I use the command system(echo MYPASSWORD | sudo -v -S); in my C code. It runs fine when I execute the demon. However, when I exit from the terminal it fails with a return value of 256. Please suggest to me some alternate way

gotoxy() function using printf() ‘s position

Hello there i am working a project which need the gotoxy() function i have read gotoxy() implementation for Linux using printf i wonder why the need to change the x y order in printf, is that just to fit the coordinate system? in my way, i change it to printf(“%c[%d;%df”,0x1B,x,y) to meet my needs…

gmon.out is not created when executable forks another executable

I am using gprof for profiling. But gmon.out is not created when I fork another executable inside the main executable which is compiled with option -pg. Any idea how to resolve it. Answer But gmon.out is not created when I fork another executable It probably does. It simply has the same name as all the other …