#include < stdio.h >
#include < stdlib.h >
#define MAX 50000
#define LEN 256
char text[MAX][LEN];
int main(int argc, char *argv[]) {
register int t,x,j;
FILE *outfile;
outfile = fopen(argv[1], "w+");
if (outfile == NULL) {
printf("\n\n Error Unable to open file! \n");
} if (argc <= 1) { printf("USAGE: ./editor [file name to open] \n\n"); exit(0); }
system("clear");
printf("OPEN FILE: %s \n Enter an empty line to quit. \n", argv[1]);
for(t = 0; t < MAX; t++) {
printf("%d: ", t);
gets(text[t]);
fprintf(outfile, "%s\n",text[t]);
if(!*text[t]) break;
}
system("clear");
printf("Output Saved to file %s \n Lines for review by editor: \n", argv[1]);
for(x = 0; x < t; x++) { for(j = 0; text[ x ][ j ]; j++) putchar(text[ x ][ j ]); putchar('\n'); }
fclose(outfile);
return 0;
}
Monday, May 18, 2015
Friday, September 6, 2013
Android Devices and MTP: How to mount such media for file transfer under linux/Ubuntu etc.
Since Honeycomb, Android devices have starting using MTP (Media Transfer Protocol) instead of the straight up USB Mass Storage (UMS) file transfer system – creating massive headaches for most Linux users and not a few Windows users & MAC as well. And since it’s become the standard since Project Ice Cream Sandwich and the Galaxy Nexus, it’s something any Linux & Android user is going to have to be able to cope with.
First, you’ll need to install the MTP file system package:
$ sudo apt-get
install mtpfs |
Next you’ll need to create a static mount point for MTP attached devices:
$ sudo mkdir
/media/MTPdevice $ sudo chmod
775 /media/MTPdevice $ sudo mtpfs
-o allow_other /media/MTPdevice |
If you don’t already know your device’s idVendor and idProduct, you can determine them by connecting your tablet/phone/device via USB and querying it using MTP. Make sure your device is in MTP mode (PTP mode should work out of the box in Linux/Ubuntu 12.04 and up, but this only accesses your DCIM firmware directory for your tablet/device camera). Android distributions of Ice Cream Sandwich and the Galaxy Nexus may auto lunch your android system settings once you connect your device. You will have two options PTP and MTP. Just to recap! By this point you will be able to transferrer files from your PC to your tablet or files back to your PC.
“F” bomb Linux will not Mount my device!
Then how do you query your device using MTP in Linux/Ubuntu?
You will have to use your Linux/Ubuntu whatever distribution you have terminal or x-term and alter some scripts. If you have the time this is how:
Note: SAMSUNG don't sue my ass for this open source example!
(this example uses a Galaxy Note II):
$ mtp-detect libmtp version: 1.1.4 Listing raw device(s) Device 0 (VID=04e8 and PID=6860) is a
Samsung GT P7310/P7510/N7000/I9070/I9100/I9300 Galaxy
Tab7.7/10.1/S2/S3/Nexus/Note/Y. Found
1 device(s): Samsung:
GTP7310/P7510/N7000/I9070/I9100/I9300 Galaxy
Tab 7.7/10.1/S2/S3/Nexus/Note/Y (04e8:6860)
@ bus 2, dev 20 Attempting to connect device(s) |
Next you’ll need to add a rule to your USB system handler to properly detect and mount your device using your favourite text editor as root:
$ gksu gedit
/etc/udev/rules.d/51-android.rules |
SUBSYSTEM=="usb",
ATTR{idVendor}==" |
$ sudo service
udev restart |
One Last thing you’ll need to unmount it before disconnecting it, just like any other mounted volume. You can either unmount from Nautilus or from the command line:
$ sudo umount
mtpfs |
SUDO Then your File Managers Name | |
Dolphin | Default file manager for KDE 4 |
emelFM2 | Orthodox file manager using GTK+ 2 |
Endeavour Mark II | A complete file management suite |
GNOME Commander | Orthodox file manager for the GNOME desktop environment |
Konqueror | Basic file management (& web browser) |
Krusader | Advanced orthodox file manager for KDE |
Midnight Commander | User-friendly yet powerful orthodox file manager |
Nautilus | Spatial file manager; default file manager for GNOME |
PCMan File Manager | Default file manager for LXDE |
ROX-Filer | RISC OS-like spatial filer |
Thunar | New modern file manager for the Xfce Desktop Environment |
Worker | In the style of Amiga's DirOpus |
Xfe | Very similiar to Windows Explorer |
4Pane | Four-pane detailed-list GTK+ file manager |
Subscribe to:
Posts (Atom)