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

GB

Name: Malcolm 2011-12-01 3:29

UK-BESTEN_KODERZ_EVAH

Name: Anonymous 2011-12-01 3:33

I've been so swamped with other finals that I've fallen behind 2 chapters in my programming class...
Someone here know how to write this in C?

Write a program that prints the number of words found in a text file. Words are defined as sequences of characters separated by white space. (Hint: white space is defined as in the fscanf function when reading a string). The program should prompt the user for the name of the file to be analyzed. It is assumed that the words in the text file are all shorter than 256 characters, and that the name of the text file is shorter than 64 characters.

The program should reproduce the following format when compiled and executed:

Enter the file name: myfile.txt
myfile.txt contains 167 words.

Name: Anonymous 2011-12-01 5:48

EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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9QA=

do md5 hash on it. i dare you

Name: F r o z e n V o i d !!mJCwdV5J0Xy2A21 2011-12-01 6:22

>>2
#include "void.h"
STDSTART
u1r wordfile=file2p(argv[1]);
u8 file_sz=filesize(argv[1]);
u8 wordcount=0,i=0;
loop:
if(isspace(wordfile[i])){
wordcount++;
while(++i<file_sz&&isspace(wordfile[i])){;};
wordcount++;}
if(++i<file_sz){goto loop;}
printf("File:%s words:%llu",argv[1],wordcount);
STDEND

Name: F r o z e n V o i d !!mJCwdV5J0Xy2A21 2011-12-01 6:24

Required header:
//==Void.h 
#ifndef _HS_VOIDH_INCLUDED_   
#ifndef __DMC__
#error "Inferior compiler detected"
#endif
#define _HS_VOIDH_INCLUDED_
#define d  #define
d inc #include
//==Included headers(Minimum required)
inc <io.h>
inc <stdio.h>
inc <stdlib.h>
inc <stddef.h>
inc <math.h>
inc <fcntl.h>
inc <ctype.h>

//==Types: [DataType(typeof)][Bytes(sizeof)]
d inl inline
d tstr typedef struct
d tp typedef
d ret return
d mal malloc
//==Basic types
#ifdef __STDINT_H
d u1 uint8_t
d s1 int8_t
d u2 uint16_t
d s2 int16_t
d s4 int32_t
d u4 uint32_t
#if __LONGLONG
d s8 int64_t
d u8 uint64_t
#endif
#else
d u1 unsigned char
d  u2 unsigned short
d  u4 unsigned int//Note:Some platforms have 8byte ints
d  u8 unsigned long long
d  s1 signed char
d  s2 signed short
d  s4 signed int
d  s8 signed long long
#endif
//==Floating point
d  f2 short float //Note:Reserved for future use
d  f4 float
d  f8 double
d  f10 long double//Note:Requires a 80bit fpu
tp void v0;//Note:0 length means *any/zero* length.
//Const pointer:array
tp const char* chc;
tp const u1* restrict u1c;
tp const u2* restrict u2c;
tp const u4* restrict u4c;
tp const u8* restrict u8c;
tp const s1* restrict s1c;
tp const s2* restrict s2c;
tp const s4* restrict s4c;
tp const s8* restrict s8c;
tp const f4* restrict f4c;
tp const f10* restrict f10c;
tp  const v0* restrict v0c;
//Restrict pointer(non aliased)
tp  u1* restrict u1r;
tp  u2* restrict  u2r;
tp  u4* restrict  u4r;
tp  u8* restrict  u8r;
tp  s1* restrict s1r;
tp  s2* restrict  s2r;
tp  s4* restrict  s4r;
tp  s8* restrict  s8r;
tp  f4* restrict f4r;
tp f10* restrict   f10r;
tp  v0* restrict   v0r;
//Aliased pointer
tp u1* u1a;
tp u2* u2a;
tp u4* u4a;
tp u8* u8a;
tp s1* s1a;
tp s2* s2a;
tp s4* s4a;
tp s8* s8a;
tp f4* f4a;
tp f10*  f10a;
tp v0* v0a;
//==Program start/end
d  STDSTART ;main(int argc,char**argv){;
d  STDEND ;return 0;};
//==ASM:
inl u8 rdtsc(){__asm{RDTSC}} //Timer 64bits
//==routines
u1r file2p(chc name){//File to pointer
u8 file_sz=filesize(name);u1r filecontent=mal(file_sz);
if(access(name,F_OK)==-1||!file_sz){ret filecontent;}

u4 filedesc=open(name,O_RDONLY|O_BINARY);
read(filedesc,filecontent,file_sz);
close(filedesc);ret filecontent;}

//End of file inclusion
#undef d
#endif

Name: F r o z e n V o i d !!mJCwdV5J0Xy2A21 2011-12-01 6:39

>>3
results in:
019768fda80afef4694e9adff7dcda28

Name: Anonymous 2011-12-01 7:48

stop smearing your shit all over the place

Name: Anonymous 2011-12-01 8:19

>>4
Good lord will you not posting your shitty code and gtfo

Name: Anonymous 2011-12-01 9:24

>>5
>#error "Inferior compiler detected"
HAHAHAhaha!

Name: Anonymous 2011-12-01 13:20

The way how FrozenVoid redefines everything and prefers proportional fonts over monospaced makes me think he's really Bjarne Stroustrup.

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