I'd like to prepare a little educational tool for SO which should help beginners (and intermediate) programmers to recognize and challenge their unwarranted assumptions in C, C++ and their platforms.
Examples:
"integers wrap around"
"everyone has ASCII"
"I can store a function pointer in a void*"
I figured that a small test program...
Good day, Stackoverflow!
I have a little (big) problem with porting one of my Python scripts for Linux to Windows. The hairy thing about this is that I have to start a process and redirect all of its streams into pipes that I go over and read and write to and from in my script.
With Linux this is a piece of cake:
server_startcmd = [
...
Hello,
I'm trying to figure out a way where I can change my current output directory using C++ code - and also need that method to be platform agnostic.
I found the direct.h header file which is Windows compatible, and the unistd.h which is UNIX/POSIX compatible. Any solutions?
Cheers.
...
I use libtiff3.9.4 for reading and writing TIFF files in c++ on my mac. My project is written to be portable and runs without any issues on both Windows 32-bit og Ubuntu 64-bit. But on the mac the Libtiff function TIFFWriteScanline always fails (it returns != 1). The TIFF file is created, but it does not have any contents.
I have tried ...
I'm dealing with large numbers coming from the hash table. I'm wondering what would be a good way of adding them to a constant (100) taking into account portability. Glib's documentation highlights that using GINT_TO_POINTER is not portable in any way. Any ideas would be appreciated!
gpointer v, old_key;
gint value; // ?
if(g_hash_tab...
Due to pressure from outside our group, we have to port over one hundred Perl scripts from Sparc to x86. This means changing dozens of shebang lines from #!/home/Perl/bin/perl -w to something else, which is a real pain. What is good way to do this (I can't find anything on Lycos)?
Also what happens when we're forced to move from x86 to...
Is this portable or at least safe to use with g++?
#include <iostream>
#include <vector>
struct c {};
std::vector<c*> v;
struct i : c { i () { v.push_back (this); } } a, b, c;
int main () {
std::cout << v.size () << "\n"; // outputs 3 with g++
}
EDIT:
Ok, what I need turned out to be a bit harder: The same code with templates:
#...
Hi,
Is there any portable version of Visual Studio (2005, 2008, 2010..)? Is it possible to use VS on a computer without installing the whole package? Virtual machines or alternative IDEs such as SharpDevelop are unfortunately out of the question.
Thank you.
...
How to make sure that my program will be fully portable?
...
How does one get the current user in a portable way? This seems like an FAQ but perlport doesn't speak about it, maybe because some odd systems don't have the concept of "user" to being with? However, let's stick to *nix and Windows.
getpwuid($>) is not implemented on Windows.
$ENV{USER} || $ENV{USERNAME} seems finicky.
http://search....
Hi all:
My current role requires me to setup environment which mimics the customer's and perform various checks to replicate and then analyze the problem.
Chances are, I often find working with Windows environments such like XP, Server 2003, Server 2008 is a bit painful without having the handly linux-based shell and some command-line ...
lpBuffer is a pointer to the first byte of a (binary)resource. How can I execute it straight away without dumping it to a temporary file?
HMODULE hLibrary;
HRSRC hResource;
HGLOBAL hResourceLoaded;
LPBYTE lpBuffer;
hLibrary = LoadLibrary("C:\\xyz.exe");
if (NULL != hLibrary)
{
hResource = FindResource(hLibrary, MAKEINTRESOURCE(104)...
Linux has a feature called namespaces, which let you give a different "view" of the filesystem to different processes. In Windows terms, this would be useful for example if you had a legacy program "floyd" that always loaded its configuration from C:\floyd\floyd.ini. If Windows had namespaces, you could write a wrapper script which wou...
I have a cshell script that is something like this:
`netstat -ap | & grep tcp | grep myprocess | awk '{print $4}' | awk 'BEGIN { FS = :"}{print $2}'`
This is how it works
1.
$ netstat -ap | & grep tcp | grep myprocess
tcp 0 0 *:1234 *:* LISTEN 8888/myprocess
2.
$ netstat -ap | & grep tcp | grep myprocess | ...
I'm working on a project which has multiple similar code paths which I'd like to separate from the main project into plugins. The project must remain cross-platform compatible, and all of the dynamic library loading APIs I've looked into are platform specific.
What's the simplest way to create a dynamic library loading system which can ...
Hi all,
I am developing portable library on java which will run on mobile device (android, blackberry) . I am looking for lightweight orm framework that i can use here here is list with orm frameworks i found in google http://java-source.net/open-source/persistence . I've used only hibernate and i' not familiar with most of them so any ...
My platform is gcc 4.4.3, C89, on Ubuntu 10.4.
I am looking for some tutorials or ebooks for installing and using the Apache portable runtime.
So far, I have only found the links below. I was looking for something with more information. A book text book that explains everything from installing apr, to linking and compiling with your ap...
Are the development environments the same? Does iPad support Java development? Any insight would be helpful.
...
Currently our code uses a for-loop for filling a buffer holding a Unicode string with some Unicode character value (of type wchar_t). There's wmemset() function in Visual C++ using which we could replace a loop with a single function call in that code. However we're concerned about portability - we'd like to leave code as portable as pos...
hello,
I have heard about portable applications, i like to make some of my utility application portable.
Does any one know if it it possible to make an app developed in vb6 portable.
I plan on replacing most controls with usercontrols, thereby no need for most MS activex controls except the runtime files.
any ideas?
[EDIT]
When i me...