Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

String manipulation & file I/O

Name: Anonymous 2007-05-13 1:42 ID:a16QPoC4

I have a text file full of thousands of md5 hashes from around the interwebs but they are seperated with newlines.

I need to open the txt hash file, and write to another file but replacing every newline with nothing.

Possible languages: Perl, C++ or Visual Basic 6.

Name: Anonymous 2007-05-13 2:22 ID:/R3s1xXj

perl: perl -pl0e'#'

of course a real programmer would do it in c:
#include <stdio.h>

int main(){
 int len;
 char* line;
 while(!feof(stdin)){
  line=fgetln(stdin,&len);
  char l2[len+1];
  memcpy(l2,line,len);
  if(!feof(stdin))--len;
  l2[len]='\0';
  fputs(l2,stdout);
 }
 return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List